--- policy: /ce/ca/oracle/compute/disable-instance-legacy-metadata-endpoint logic: /ce/ca/oracle/compute/disable-instance-legacy-metadata-endpoint/prod.logic.yaml executionTime: 2026-05-02T12:07:21.544136593Z generationMs: 66 executionMs: 1825 rows: - id: test1 match: true status: expected: DISAPPEARED actual: DISAPPEARED conditionIndex: expected: 99 actual: 99 conditionText: expected: isDisappeared(CA10O1__disappearanceTime__c) actual: isDisappeared(CA10O1__disappearanceTime__c) runtimeError: {} - id: test2 match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 199 actual: 199 conditionText: expected: extract('CA10O1__instanceOptionsLegacyImdsEndpoints__c').isEmpty() actual: extract('CA10O1__instanceOptionsLegacyImdsEndpoints__c').isEmpty() runtimeError: {} - id: test3 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 299 actual: 299 conditionText: expected: extract('CA10O1__instanceOptionsLegacyImdsEndpoints__c') == 'Enabled' actual: extract('CA10O1__instanceOptionsLegacyImdsEndpoints__c') == 'Enabled' runtimeError: {} - id: test4 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 399 actual: 399 conditionText: expected: extract('CA10O1__instanceOptionsLegacyImdsEndpoints__c') == 'Disabled' actual: extract('CA10O1__instanceOptionsLegacyImdsEndpoints__c') == 'Disabled' runtimeError: {} - id: test5 match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 400 actual: 400 conditionText: expected: otherwise actual: otherwise runtimeError: {} usedFiles: - path: /ce/ca/oracle/compute/disable-instance-legacy-metadata-endpoint/policy.yaml md5Hash: A52363AE573C46B53C0C643838C392C4 content: "---\nnames:\n full: \"Oracle IAAS Instance legacy IMDS endpoints are\ \ enabled\"\n contextual: \"Oracle IAAS Instance legacy IMDS endpoints are\ \ enabled\"\ndescription: >\n Ensure that Oracle IAAS Instances have legacy\ \ Instance Metadata Service (IMDS) \n endpoints disabled. Legacy IMDS endpoints\ \ support older metadata access behavior \n and can increase the risk of metadata\ \ or credential exposure if software running \n on the instance is affected\ \ by SSRF, open proxy behavior, or similar request-forwarding \n vulnerabilities.\n\ type: \"COMPLIANCE_POLICY\"\ncategories:\n - \"SECURITY\"\nframeworkMappings:\n\ \ - \"/frameworks/cis-oracle-v3.1.0/03/01\"\n - \"/frameworks/cloudaware/resource-security/secure-access\"\ \n" - path: /ce/ca/oracle/compute/disable-instance-legacy-metadata-endpoint/prod.logic.yaml md5Hash: D25F020B75991F3654F3609FBE1EEC8E content: | --- inputType: "CA10O1__CaOracleIaasInstance__c" testData: - file: "test-data.json" importExtracts: - file: "/types/CA10O1__CaOracleIaasInstance__c/object.extracts.yaml" conditions: - status: "UNDETERMINED" currentStateMessage: "The legacy metadata service endpoint setting is not available for this instance." check: IS_EMPTY: arg: EXTRACT: "CA10O1__instanceOptionsLegacyImdsEndpoints__c" - status: "INCOMPLIANT" currentStateMessage: "The legacy metadata service endpoint is enabled for this instance." remediationMessage: "Disable legacy IMDS endpoints for this instance." check: IS_EQUAL: left: EXTRACT: "CA10O1__instanceOptionsLegacyImdsEndpoints__c" right: TEXT: "Enabled" - status: "COMPLIANT" currentStateMessage: "Legacy metadata service endpoints are disabled for this instance." check: IS_EQUAL: left: EXTRACT: "CA10O1__instanceOptionsLegacyImdsEndpoints__c" right: TEXT: "Disabled" otherwise: status: "UNDETERMINED" currentStateMessage: "Unexpected value in the legacy metadata service endpoint setting." - path: /ce/ca/oracle/compute/disable-instance-legacy-metadata-endpoint/test-data.json md5Hash: 8D84AF15DD8A167775A217A73949291E content: | [ { "expectedResult": { "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10O1__disappearanceTime__c)", "runtimeError": null }, "context": { "snapshotTime": "2026-04-12T00:00:00Z" }, "Id": "test1", "CA10O1__disappearanceTime__c": "2026-04-11T00:00:00Z", "CA10O1__instanceOptionsLegacyImdsEndpoints__c": "Enabled" }, { "expectedResult": { "status": "UNDETERMINED", "conditionIndex": "199", "conditionText": "extract('CA10O1__instanceOptionsLegacyImdsEndpoints__c').isEmpty()", "runtimeError": null }, "context": { "snapshotTime": "2026-04-12T00:00:00Z" }, "Id": "test2", "CA10O1__disappearanceTime__c": null, "CA10O1__instanceOptionsLegacyImdsEndpoints__c": "" }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "299", "conditionText": "extract('CA10O1__instanceOptionsLegacyImdsEndpoints__c') == 'Enabled'", "runtimeError": null }, "context": { "snapshotTime": "2026-04-12T00:00:00Z" }, "Id": "test3", "CA10O1__disappearanceTime__c": null, "CA10O1__instanceOptionsLegacyImdsEndpoints__c": "Enabled" }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "399", "conditionText": "extract('CA10O1__instanceOptionsLegacyImdsEndpoints__c') == 'Disabled'", "runtimeError": null }, "context": { "snapshotTime": "2026-04-12T00:00:00Z" }, "Id": "test4", "CA10O1__disappearanceTime__c": null, "CA10O1__instanceOptionsLegacyImdsEndpoints__c": "Disabled" }, { "expectedResult": { "status": "UNDETERMINED", "conditionIndex": "400", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2026-04-12T00:00:00Z" }, "Id": "test5", "CA10O1__disappearanceTime__c": null, "CA10O1__instanceOptionsLegacyImdsEndpoints__c": "Unexpected" } ] - path: /types/CA10O1__CaOracleIaasInstance__c/object.extracts.yaml md5Hash: 0C380BCFB27869AC64860559F80FEA7E content: | --- extracts: - name: "CA10O1__instanceOptionsLegacyImdsEndpoints__c" value: FIELD: path: "CA10O1__instanceOptionsLegacyImdsEndpoints__c" - name: "CA10O1__platformConfigJson__c" value: FIELD: path: "CA10O1__platformConfigJson__c" undeterminedIf: isEmpty: "Instance platform configuration cannot be empty." - name: "caJsonFrom__platformConfigJson__c" value: JSON_FROM: arg: EXTRACT: "CA10O1__platformConfigJson__c" undeterminedIf: isInvalid: "Platform configuration JSON is invalid." isEmpty: "Platform configuration JSON is empty." - name: "CA10O1__bootVolumePvEncryptionInTransit__c" value: FIELD: path: "CA10O1__bootVolumePvEncryptionInTransit__c" undeterminedIf: isEmpty: "The boot volume in-transit encryption option cannot be empty." - name: "CA10O1__sourceDetailsKmsKeyOcid__c" value: FIELD: path: "CA10O1__sourceDetailsKmsKeyOcid__c" script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "test1", "expectedResult" : { "status" : "DISAPPEARED", "conditionIndex" : "99", "conditionText" : "isDisappeared(CA10O1__disappearanceTime__c)", "runtimeError" : null } }, { "Id" : "test2", "expectedResult" : { "status" : "UNDETERMINED", "conditionIndex" : "199", "conditionText" : "extract('CA10O1__instanceOptionsLegacyImdsEndpoints__c').isEmpty()", "runtimeError" : null } }, { "Id" : "test3", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "299", "conditionText" : "extract('CA10O1__instanceOptionsLegacyImdsEndpoints__c') == 'Enabled'", "runtimeError" : null } }, { "Id" : "test4", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "399", "conditionText" : "extract('CA10O1__instanceOptionsLegacyImdsEndpoints__c') == 'Disabled'", "runtimeError" : null } }, { "Id" : "test5", "expectedResult" : { "status" : "UNDETERMINED", "conditionIndex" : "400", "conditionText" : "otherwise", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10O1__CaOracleIaasInstance__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2026-04-12T00:00:00Z") }, "CA10O1__disappearanceTime__c" : new Date("2026-04-11T00:00:00Z"), "CA10O1__instanceOptionsLegacyImdsEndpoints__c" : "Enabled", "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2026-04-12T00:00:00Z") }, "CA10O1__instanceOptionsLegacyImdsEndpoints__c" : "", "Id" : "test2" }, { "context" : { "snapshotTime" : new Date("2026-04-12T00:00:00Z") }, "CA10O1__instanceOptionsLegacyImdsEndpoints__c" : "Enabled", "Id" : "test3" }, { "context" : { "snapshotTime" : new Date("2026-04-12T00:00:00Z") }, "CA10O1__instanceOptionsLegacyImdsEndpoints__c" : "Disabled", "Id" : "test4" }, { "context" : { "snapshotTime" : new Date("2026-04-12T00:00:00Z") }, "CA10O1__instanceOptionsLegacyImdsEndpoints__c" : "Unexpected", "Id" : "test5" } ]; """; CREATE TEMP FUNCTION process_CA10O1__CaOracleIaasInstance__c( obj STRUCT< CA10O1__disappearanceTime__c TIMESTAMP, CA10O1__instanceOptionsLegacyImdsEndpoints__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__instanceOptionsLegacyImdsEndpoints__c; } return this.out; }; references1.push('Instance Options: Legacy IMDS Endpoints [obj.CA10O1__instanceOptionsLegacyImdsEndpoints__c]: ' + obj.CA10O1__instanceOptionsLegacyImdsEndpoints__c); if (TextLib.isEmpty(extract3.call(extract3))) { return {status: 'UNDETERMINED', conditionIndex: 199, conditionText: "extract('CA10O1__instanceOptionsLegacyImdsEndpoints__c').isEmpty()", currentStateMessage: "The legacy metadata service endpoint setting is not available for this instance.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[2], conditionIndex:[200..299] function extract6() { if (!this.out) { this.out = obj.CA10O1__instanceOptionsLegacyImdsEndpoints__c; } return this.out; }; if (TextLib.equal(extract6.call(extract6), 'Enabled')) { return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "extract('CA10O1__instanceOptionsLegacyImdsEndpoints__c') == 'Enabled'", currentStateMessage: "The legacy metadata service endpoint is enabled for this instance.", currentStateReferences: references1.join('\n'), remediation: "Disable legacy IMDS endpoints for this instance.", runtimeError: null}; } // condition[3], conditionIndex:[300..399] function extract9() { if (!this.out) { this.out = obj.CA10O1__instanceOptionsLegacyImdsEndpoints__c; } return this.out; }; if (TextLib.equal(extract9.call(extract9), 'Disabled')) { return {status: 'COMPLIANT', conditionIndex: 399, conditionText: "extract('CA10O1__instanceOptionsLegacyImdsEndpoints__c') == 'Disabled'", currentStateMessage: "Legacy metadata service endpoints are disabled for this instance.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'UNDETERMINED', conditionIndex: 400, conditionText: "otherwise", currentStateMessage: "Unexpected value in the legacy metadata service endpoint setting.", 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__instanceOptionsLegacyImdsEndpoints__c AS CA10O1__instanceOptionsLegacyImdsEndpoints__c, sObject.Id AS Id, process_CA10O1__CaOracleIaasInstance__c( STRUCT( sObject.CA10O1__disappearanceTime__c AS CA10O1__disappearanceTime__c, sObject.CA10O1__instanceOptionsLegacyImdsEndpoints__c AS CA10O1__instanceOptionsLegacyImdsEndpoints__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10O1__CaOracleIaasInstance__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;