--- policy: /ce/ca/aws/acm/certificate-expired logic: /ce/ca/aws/acm/certificate-expired/prod.logic.yaml executionTime: 2026-02-10T22:32:29.906386697Z generationMs: 58 executionMs: 956 rows: - id: test1 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 200 actual: 200 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test2 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 199 actual: 199 conditionText: expected: extract('CA10__status__c') == 'EXPIRED' actual: extract('CA10__status__c') == 'EXPIRED' runtimeError: {} - id: test3 match: true status: expected: DISAPPEARED actual: DISAPPEARED conditionIndex: expected: 99 actual: 99 conditionText: expected: isDisappeared(CA10__disappearanceTime__c) actual: isDisappeared(CA10__disappearanceTime__c) runtimeError: {} usedFiles: - path: /ce/ca/aws/acm/certificate-expired/policy.yaml md5Hash: 266C4A4AA5068EC5154F2BF35B56724B content: "---\nnames:\n full: AWS ACM Certificate Expired\n contextual: Certificate\ \ Expired\ndescription: >\n Remove all expired SSL/TLS certificates in AWS\ \ Certificate Manager to comply \n with Amazon Security Best Practices. This\ \ action mitigates risks associated \n with outdated certificates, which can\ \ lead to vulnerabilities and compromised \n security. AWS Certificate Manager\ \ provisions, manages, and deploys SSL/TLS \n certificates for services like\ \ Elastic Load Balancing and CloudFront, ensuring \n secure communications.\n\ categories:\n - \"SECURITY\"\n - \"RELIABILITY\"\ntype: \"COMPLIANCE_POLICY\"\ \nframeworkMappings:\n - \"/frameworks/cloudaware/secret-and-certificate-governance/expiration-management\"\ \nsimilarPolicies:\n internal:\n - dec-x-689858b5\n cloudConformity:\n\ \ - url: https://www.trendmicro.com/cloudoneconformity/knowledge-base/aws/ACM/expired-certificate.html\n\ \ name: ACM Certificate Expired\n" - path: /ce/ca/aws/acm/certificate-expired/prod.logic.yaml md5Hash: D9EBFB27E9E31B9275ED70564BD02A7B content: | --- inputType: "CA10__CaAwsAcmCertificate__c" testData: - file: test-data.json importExtracts: - file: /types/CA10__CaAwsAcmCertificate__c/object.extracts.yaml conditions: - status: "INCOMPLIANT" currentStateMessage: "This certificate is expired." remediationMessage: "Remove, re-import, or renew the expired certificate." check: IS_EQUAL: left: EXTRACT: "CA10__status__c" right: TEXT: "EXPIRED" otherwise: status: "COMPLIANT" currentStateMessage: "The certificate is not expired." - path: /ce/ca/aws/acm/certificate-expired/test-data.json md5Hash: 72A52AEE7CC6AF5B30B6EAC1722BB213 content: |- [ { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "200", "conditionText": "otherwise", "runtimeError": null }, "Id": "test1", "CA10__disappearanceTime__c": null, "CA10__status__c": "ISSUED" }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "199", "conditionText": "extract('CA10__status__c') == 'EXPIRED'", "runtimeError": null }, "Id": "test2", "CA10__disappearanceTime__c": null, "CA10__status__c": "EXPIRED" }, { "expectedResult": { "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "runtimeError": null }, "Id": "test3", "CA10__disappearanceTime__c": "2024-04-30T13:16:02Z", "CA10__status__c": "ISSUED" } ] - path: /types/CA10__CaAwsAcmCertificate__c/object.extracts.yaml md5Hash: D20EE095842A506CDEF3AC47E90A5A3B content: "---\nextracts:\n# Values: PENDING_VALIDATION | ISSUED | INACTIVE | EXPIRED\ \ | REVOKED | FAILED | VALIDATION_TIMED_OUT\n# Not Nullable can't have no access\n\ \ - name: CA10__status__c\n value: \n FIELD:\n path: CA10__status__c\n\ \ undeterminedIf:\n noAccessDelegate:\n path: CA10__status__c\n\ \ currentStateMessage: Unable to determine certificate status. Possible\ \ permission issue with acm:DescribeCertificate\n isEmpty: Status is\ \ not populated yet\n# Nullable\n - name: CA10__notAfter__c\n value: \n\ \ FIELD:\n path: CA10__notAfter__c\n undeterminedIf:\n \ \ noAccessDelegate:\n path: CA10__notAfter__c\n \ \ currentStateMessage: Unable to determine certificate 'NotAfter'. Possible\ \ permission issue with acm:DescribeCertificate\n# Not Nullable\n - name: CA10__domainName__c\n\ \ value: \n FIELD:\n path: CA10__domainName__c\n undeterminedIf:\n\ \ noAccessDelegate:\n path: CA10__domainName__c\n \ \ currentStateMessage: Unable to determine certificate domain name. Possible\ \ permission issue with acm:DescribeCertificate\n isEmpty: Domain name\ \ is not populated yet\n# Values: ELIGIBLE | INELIGIBLE, Not Nullable\n - name:\ \ CA10__renewalEligibility__c\n value: \n FIELD:\n path: CA10__renewalEligibility__c\n\ \ undeterminedIf:\n noAccessDelegate:\n path: CA10__renewalEligibility__c\n\ \ currentStateMessage: Unable to determine certificate renewal eligibility.\ \ Possible permission issue with acm:DescribeCertificate\n isEmpty:\ \ Renewal eligibility is not populated yet\n# Values: RSA-1024 | RSA-2048 |\ \ RSA-3072 | RSA-4096 | EC-prime256v1 | EC-secp384r1 | EC-secp521r1\n# Not Nullable\n\ \ - name: CA10__keyAlgorithm__c\n value: \n FIELD:\n path: CA10__keyAlgorithm__c\n\ \ undeterminedIf:\n noAccessDelegate:\n path: CA10__keyAlgorithm__c\n\ \ currentStateMessage: Unable to determine certificate status. Possible\ \ permission issue with acm:DescribeCertificate\n isEmpty: Key Algorithm\ \ is not populated yet\n" script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "test1", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "200", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "test2", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "199", "conditionText" : "extract('CA10__status__c') == 'EXPIRED'", "runtimeError" : null } }, { "Id" : "test3", "expectedResult" : { "status" : "DISAPPEARED", "conditionIndex" : "99", "conditionText" : "isDisappeared(CA10__disappearanceTime__c)", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsAcmCertificate__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "CA10__status__c" : "ISSUED", "Id" : "test1" }, { "CA10__status__c" : "EXPIRED", "Id" : "test2" }, { "CA10__disappearanceTime__c" : new Date("2024-04-30T13:16:02Z"), "CA10__status__c" : "ISSUED", "Id" : "test3" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsAcmCertificate__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__status__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 AWS [CA10__disappearanceTime__c]: ' + obj.CA10__disappearanceTime__c); if (obj.CA10__disappearanceTime__c != null) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[1], conditionIndex:[100..199] function fieldChecked4() { if (TextLib.isEmpty(obj.CA10__status__c)) { throw new Error("UNDETERMINED condition:101", {cause: {status: 'UNDETERMINED', conditionIndex: 101, conditionText: "CA10__status__c.delegatedTo(CA10__status__c).isEmpty()", currentStateMessage: "Unable to determine certificate status. Possible permission issue with acm:DescribeCertificate", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } if (TextLib.isEmpty(obj.CA10__status__c)) { throw new Error("UNDETERMINED condition:102", {cause: {status: 'UNDETERMINED', conditionIndex: 102, conditionText: "CA10__status__c.isEmpty()", currentStateMessage: "Status is not populated yet", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__status__c; } function extract3() { if (!this.out) { this.out = fieldChecked4(); } return this.out; }; references1.push('Status [obj.CA10__status__c]: ' + obj.CA10__status__c); try { if (TextLib.equal(extract3.call(extract3), 'EXPIRED')) { return {status: 'INCOMPLIANT', conditionIndex: 199, conditionText: "extract('CA10__status__c') == 'EXPIRED'", currentStateMessage: "This certificate is expired.", currentStateReferences: references1.join('\n'), remediation: "Remove, re-import, or renew the expired certificate.", runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } return {status: 'COMPLIANT', conditionIndex: 200, conditionText: "otherwise", currentStateMessage: "The certificate is not expired.", 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.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__status__c AS CA10__status__c, sObject.Id AS Id, process_CA10__CaAwsAcmCertificate__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__status__c AS CA10__status__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsAcmCertificate__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;