--- policy: /ce/ca/oracle/iam/user-api-keys-are-not-rotated-every-90-days logic: /ce/ca/oracle/iam/user-api-keys-are-not-rotated-every-90-days/prod.logic.yaml executionTime: 2026-05-02T12:07:24.770110658Z generationMs: 55 executionMs: 2224 rows: - id: test1 match: true status: expected: INAPPLICABLE actual: INAPPLICABLE conditionIndex: expected: 199 actual: 199 conditionText: expected: extract('CA10O1__lifecycleState__c') != 'ACTIVE' actual: extract('CA10O1__lifecycleState__c') != 'ACTIVE' runtimeError: {} - id: test2 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 299 actual: 299 conditionText: expected: extract('CA10O1__timeCreated__c').beyondLastDays(90) actual: extract('CA10O1__timeCreated__c').beyondLastDays(90) runtimeError: {} - id: test3 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 300 actual: 300 conditionText: expected: otherwise actual: otherwise runtimeError: {} usedFiles: - path: /ce/ca/oracle/iam/user-api-keys-are-not-rotated-every-90-days/policy.yaml md5Hash: 64B5B90788BF30A37576007561DF6C73 content: | --- names: full: "Oracle IAM User API keys are not rotated every 90 days" contextual: "IAM User API keys are not rotated every 90 days" description: > Oracle IAM user API keys should be rotated at least every 90 days. Stale active API keys increase the exposure window for compromised long-term credentials. type: COMPLIANCE_POLICY categories: - SECURITY frameworkMappings: - "/frameworks/cis-oracle-v3.1.0/01/08" - "/frameworks/cloudaware/identity-and-access-governance/credential-lifecycle-management" - path: /ce/ca/oracle/iam/user-api-keys-are-not-rotated-every-90-days/prod.logic.yaml md5Hash: 9B6FB6CF3AA1698127A6308C157CA8F1 content: | --- inputType: "CA10O1__CaOracleIamUserApiKey__c" testData: - file: test-data.json importExtracts: - file: /types/CA10O1__CaOracleIamUserApiKey__c/object.extracts.yaml conditions: - status: "INAPPLICABLE" currentStateMessage: "This Oracle IAM API key is not active." check: NOT_EQUAL: left: EXTRACT: "CA10O1__lifecycleState__c" right: TEXT: "ACTIVE" - status: "INCOMPLIANT" currentStateMessage: "This active Oracle IAM API key is older than 90 days." remediationMessage: "Rotate this Oracle IAM API key and delete the stale key after dependent workloads are updated." check: IS_BEYOND_LAST_DAYS: arg: EXTRACT: "CA10O1__timeCreated__c" offsetDays: 90 otherwise: status: "COMPLIANT" currentStateMessage: "This active Oracle IAM API key was created within the last 90 days." - path: /ce/ca/oracle/iam/user-api-keys-are-not-rotated-every-90-days/test-data.json md5Hash: 907DC254B0B6226C0B283151B95F6066 content: | [ { "expectedResult": { "status": "INAPPLICABLE", "conditionIndex": "199", "conditionText": "extract('CA10O1__lifecycleState__c') != 'ACTIVE'", "runtimeError": null }, "context": { "snapshotTime": "2026-04-12T00:00:00Z" }, "Id": "test1", "CA10O1__disappearanceTime__c": null, "CA10O1__lifecycleState__c": "INACTIVE", "CA10O1__timeCreated__c": "2025-01-01T00:00:00Z" }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "299", "conditionText": "extract('CA10O1__timeCreated__c').beyondLastDays(90)", "runtimeError": null }, "context": { "snapshotTime": "2026-04-12T00:00:00Z" }, "Id": "test2", "CA10O1__disappearanceTime__c": null, "CA10O1__lifecycleState__c": "ACTIVE", "CA10O1__timeCreated__c": "2025-01-01T00:00:00Z" }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "300", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2026-04-12T00:00:00Z" }, "Id": "test3", "CA10O1__disappearanceTime__c": null, "CA10O1__lifecycleState__c": "ACTIVE", "CA10O1__timeCreated__c": "2026-04-01T00:00:00Z" } ] - path: /types/CA10O1__CaOracleIamUserApiKey__c/object.extracts.yaml md5Hash: AA56F5592EB714844CCA7BC8D8BA5839 content: | --- extracts: # Not nullable. - name: "CA10O1__lifecycleState__c" value: FIELD: path: "CA10O1__lifecycleState__c" # Not nullable. - name: "CA10O1__timeCreated__c" value: FIELD: path: "CA10O1__timeCreated__c" script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "test1", "expectedResult" : { "status" : "INAPPLICABLE", "conditionIndex" : "199", "conditionText" : "extract('CA10O1__lifecycleState__c') != 'ACTIVE'", "runtimeError" : null } }, { "Id" : "test2", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "299", "conditionText" : "extract('CA10O1__timeCreated__c').beyondLastDays(90)", "runtimeError" : null } }, { "Id" : "test3", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "300", "conditionText" : "otherwise", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10O1__CaOracleIamUserApiKey__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2026-04-12T00:00:00Z") }, "CA10O1__lifecycleState__c" : "INACTIVE", "CA10O1__timeCreated__c" : new Date("2025-01-01T00:00:00Z"), "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2026-04-12T00:00:00Z") }, "CA10O1__lifecycleState__c" : "ACTIVE", "CA10O1__timeCreated__c" : new Date("2025-01-01T00:00:00Z"), "Id" : "test2" }, { "context" : { "snapshotTime" : new Date("2026-04-12T00:00:00Z") }, "CA10O1__lifecycleState__c" : "ACTIVE", "CA10O1__timeCreated__c" : new Date("2026-04-01T00:00:00Z"), "Id" : "test3" } ]; """; CREATE TEMP FUNCTION process_CA10O1__CaOracleIamUserApiKey__c( obj STRUCT< CA10O1__disappearanceTime__c TIMESTAMP, CA10O1__lifecycleState__c STRING, CA10O1__timeCreated__c TIMESTAMP, 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 todayMinus90Day = new Date(snapshotTime.toISOString().substr(0,10)+'T00:00:00.000Z').getTime() + (-90 * 86400000); 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__lifecycleState__c; } return this.out; }; references1.push('Lifecycle State [obj.CA10O1__lifecycleState__c]: ' + obj.CA10O1__lifecycleState__c); if (TextLib.notEqual(extract3.call(extract3), 'ACTIVE')) { return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "extract('CA10O1__lifecycleState__c') != 'ACTIVE'", currentStateMessage: "This Oracle IAM API key is not active.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[2], conditionIndex:[200..299] function extract6() { if (!this.out) { this.out = obj.CA10O1__timeCreated__c; } return this.out; }; references1.push('Time Created [obj.CA10O1__timeCreated__c]: ' + obj.CA10O1__timeCreated__c); if (extract6.call(extract6) != null && extract6.call(extract6).getTime() < todayMinus90Day) { return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "extract('CA10O1__timeCreated__c').beyondLastDays(90)", currentStateMessage: "This active Oracle IAM API key is older than 90 days.", currentStateReferences: references1.join('\n'), remediation: "Rotate this Oracle IAM API key and delete the stale key after dependent workloads are updated.", runtimeError: null}; } return {status: 'COMPLIANT', conditionIndex: 300, conditionText: "otherwise", currentStateMessage: "This active Oracle IAM API key was created within the last 90 days.", currentStateReferences: references1.join('\n'), remediation: null, 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__lifecycleState__c AS CA10O1__lifecycleState__c, sObject.CA10O1__timeCreated__c AS CA10O1__timeCreated__c, sObject.Id AS Id, process_CA10O1__CaOracleIamUserApiKey__c( STRUCT( sObject.CA10O1__disappearanceTime__c AS CA10O1__disappearanceTime__c, sObject.CA10O1__lifecycleState__c AS CA10O1__lifecycleState__c, sObject.CA10O1__timeCreated__c AS CA10O1__timeCreated__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10O1__CaOracleIamUserApiKey__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;