--- policy: /ce/ca/oracle/bucket/bucket-cmk-encryption logic: /ce/ca/oracle/bucket/bucket-cmk-encryption/prod.logic.yaml executionTime: 2026-05-02T12:07:18.49242044Z generationMs: 60 executionMs: 2093 rows: - id: test1 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 199 actual: 199 conditionText: expected: extract('CA10O1__kmsKeyOcid__c').isNotEmpty() actual: extract('CA10O1__kmsKeyOcid__c').isNotEmpty() runtimeError: {} - id: test2 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 200 actual: 200 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test3 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 200 actual: 200 conditionText: expected: otherwise actual: otherwise runtimeError: {} usedFiles: - path: /ce/ca/oracle/bucket/bucket-cmk-encryption/policy.yaml md5Hash: 56BDF83254BE4FCCC9F269CA4EE64DB4 content: | --- names: full: "Oracle Storage Bucket is not encrypted with a customer managed key" contextual: "Storage Bucket is not encrypted with a customer managed key" description: > Ensure that Oracle Storage Buckets use customer managed keys from OCI Vault for server-side encryption. Customer managed keys provide stronger control over key access, rotation, auditing, and revocation than provider-managed encryption keys. type: "COMPLIANCE_POLICY" categories: - "SECURITY" frameworkMappings: - "/frameworks/cis-oracle-v3.1.0/05/01/02" - "/frameworks/cloudaware/resource-security/data-encryption" similarPolicies: internal: - "dec-x-6664ebac" - path: /ce/ca/oracle/bucket/bucket-cmk-encryption/prod.logic.yaml md5Hash: CEC7E8E2368C356E718224FC9E02D460 content: | --- inputType: "CA10O1__CaOracleStorageBucket__c" testData: - file: "test-data.json" importExtracts: - file: "/types/CA10O1__CaOracleStorageBucket__c/object.extracts.yaml" conditions: - status: "COMPLIANT" currentStateMessage: "The bucket is encrypted with a customer managed key." check: NOT_EMPTY: arg: EXTRACT: "CA10O1__kmsKeyOcid__c" otherwise: status: "INCOMPLIANT" currentStateMessage: "The bucket is not encrypted with a customer managed key." remediationMessage: "Configure the bucket to use a customer managed key from OCI Vault." - path: /ce/ca/oracle/bucket/bucket-cmk-encryption/test-data.json md5Hash: 2E2C9084FB42FFD6368644B67486DA11 content: | [ { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "199", "conditionText": "extract('CA10O1__kmsKeyOcid__c').isNotEmpty()", "runtimeError": null }, "context": { "snapshotTime": "2026-04-12T00:00:00Z" }, "Id": "test1", "CA10O1__disappearanceTime__c": null, "CA10O1__kmsKeyOcid__c": "ocid1.key.oc1..bucketcmk" }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "200", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2026-04-12T00:00:00Z" }, "Id": "test2", "CA10O1__disappearanceTime__c": null, "CA10O1__kmsKeyOcid__c": "" }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "200", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2026-04-12T00:00:00Z" }, "Id": "test3", "CA10O1__disappearanceTime__c": null, "CA10O1__kmsKeyOcid__c": null } ] - path: /types/CA10O1__CaOracleStorageBucket__c/object.extracts.yaml md5Hash: 4A2A185CC5E21E043DA4F3BC71A4FDDA content: | --- extracts: - name: "CA10O1__publicAccessType__c" value: FIELD: path: "CA10O1__publicAccessType__c" undeterminedIf: isEmpty: "The bucket Public Access Type is empty." - name: "CA10O1__versioning__c" value: FIELD: path: "CA10O1__versioning__c" undeterminedIf: isEmpty: "The bucket Versioning field is empty." - name: "CA10O1__kmsKeyOcid__c" value: FIELD: path: "CA10O1__kmsKeyOcid__c" script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "test1", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "199", "conditionText" : "extract('CA10O1__kmsKeyOcid__c').isNotEmpty()", "runtimeError" : null } }, { "Id" : "test2", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "200", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "test3", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "200", "conditionText" : "otherwise", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10O1__CaOracleStorageBucket__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2026-04-12T00:00:00Z") }, "CA10O1__kmsKeyOcid__c" : "ocid1.key.oc1..bucketcmk", "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2026-04-12T00:00:00Z") }, "CA10O1__kmsKeyOcid__c" : "", "Id" : "test2" }, { "context" : { "snapshotTime" : new Date("2026-04-12T00:00:00Z") }, "CA10O1__kmsKeyOcid__c" : null, "Id" : "test3" } ]; """; CREATE TEMP FUNCTION process_CA10O1__CaOracleStorageBucket__c( obj STRUCT< CA10O1__disappearanceTime__c TIMESTAMP, CA10O1__kmsKeyOcid__c STRING, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" var TextLib = new function () { this.normalize = function(arg) { return arg == null ? '' : arg.replace(/\s+/g, ' ').trim().toLowerCase(); }; this.isEmpty = function(arg) { return this.normalize(arg) == ''; }; this.isNotEmpty = function(arg) { return this.normalize(arg) != ''; }; this.equal = function(left, right) { return this.normalize(left) == this.normalize(right); }; this.notEqual = function(left, right) { return this.normalize(left) != this.normalize(right); }; this.startsWith = function(arg, substring) { return this.normalize(arg).startsWith(this.normalize(substring)); }; this.endsWith = function(arg, substring) { return this.normalize(arg).endsWith(this.normalize(substring)); }; this.contains = function(arg, substring) { return this.normalize(arg).includes(this.normalize(substring)); }; this.containsAll = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.every(sub => normalizedArg.includes(this.normalize(sub))); }; this.containsAny = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.some(sub => normalizedArg.includes(this.normalize(sub))); }; }(); var references1 = []; // condition[0], conditionIndex:[0..99] references1.push('Deleted From Oracle [CA10O1__disappearanceTime__c]: ' + obj.CA10O1__disappearanceTime__c); if (obj.CA10O1__disappearanceTime__c != null) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10O1__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[1], conditionIndex:[100..199] function extract3() { if (!this.out) { this.out = obj.CA10O1__kmsKeyOcid__c; } return this.out; }; references1.push('KMS Key OCID [obj.CA10O1__kmsKeyOcid__c]: ' + obj.CA10O1__kmsKeyOcid__c); if (TextLib.isNotEmpty(extract3.call(extract3))) { return {status: 'COMPLIANT', conditionIndex: 199, conditionText: "extract('CA10O1__kmsKeyOcid__c').isNotEmpty()", currentStateMessage: "The bucket is encrypted with a customer managed key.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'INCOMPLIANT', conditionIndex: 200, conditionText: "otherwise", currentStateMessage: "The bucket is not encrypted with a customer managed key.", currentStateReferences: references1.join('\n'), remediation: "Configure the bucket to use a customer managed key from OCI Vault.", runtimeError: null}; """; SELECT expectedResult.Id as Id, IF ( IFNULL(expectedResult.expectedResult.status, '') = IFNULL(sObject.result.status, '') AND IFNULL(expectedResult.expectedResult.conditionIndex, -1) = IFNULL(sObject.result.conditionIndex, -1) AND IFNULL(expectedResult.expectedResult.conditionText, '') = IFNULL(sObject.result.conditionText, '') AND IFNULL(expectedResult.expectedResult.runtimeError, '') = IFNULL(sObject.result.runtimeError, ''), "MATCH", "FAIL" ) as match, expectedResult.expectedResult.status as expectedStatus, sObject.result.status as actualStatus, expectedResult.expectedResult.conditionIndex as expectedConditionIndex, sObject.result.conditionIndex as actualConditionIndex, expectedResult.expectedResult.conditionText as expectedConditionText, sObject.result.conditionText as actualConditionText, expectedResult.expectedResult.runtimeError as expectedRuntimeError, sObject.result.runtimeError as actualRuntimeError FROM UNNEST(mock_ExpectedResult()) expectedResult LEFT JOIN ( SELECT sObject.CA10O1__disappearanceTime__c AS CA10O1__disappearanceTime__c, sObject.CA10O1__kmsKeyOcid__c AS CA10O1__kmsKeyOcid__c, sObject.Id AS Id, process_CA10O1__CaOracleStorageBucket__c( STRUCT( sObject.CA10O1__disappearanceTime__c AS CA10O1__disappearanceTime__c, sObject.CA10O1__kmsKeyOcid__c AS CA10O1__kmsKeyOcid__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10O1__CaOracleStorageBucket__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;