--- policy: /ce/ca/aws/mq/broker-logging logic: /ce/ca/aws/mq/broker-logging/prod.logic.yaml executionTime: 2026-02-10T22:33:04.733958543Z generationMs: 60 executionMs: 774 rows: - id: test1 match: true status: expected: DISAPPEARED actual: DISAPPEARED conditionIndex: expected: 99 actual: 99 conditionText: expected: isDisappeared(CA10__disappearanceTime__c) actual: isDisappeared(CA10__disappearanceTime__c) runtimeError: {} - id: test2 match: true status: expected: INAPPLICABLE actual: INAPPLICABLE conditionIndex: expected: 199 actual: 199 conditionText: expected: extract('CA10__engineType__c') != 'ACTIVEMQ' actual: extract('CA10__engineType__c') != 'ACTIVEMQ' runtimeError: {} - id: test3 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 399 actual: 399 conditionText: expected: extract('CA10__logsAudit__c') == 'Disabled' actual: extract('CA10__logsAudit__c') == 'Disabled' runtimeError: {} - id: test4 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 499 actual: 499 conditionText: expected: extract('CA10__logsAudit__c') == 'Enabled' actual: extract('CA10__logsAudit__c') == 'Enabled' runtimeError: {} usedFiles: - path: /ce/ca/aws/mq/broker-logging/policy.yaml md5Hash: 03938E5300A08F546D128DABA709BBBF content: "---\nnames:\n full: \"AWS MQ ActiveMQ Broker Audit Logging is not enabled\"\ \n contextual: \"ActiveMQ Broker Audit Logging is not enabled\"\ndescription:\ \ >\n Ensure that Amazon MQ brokers have audit logging enabled. Audit logs\ \ provide a \n record of management actions performed on the broker via the\ \ API or the web console, \n which is essential for security auditing and tracking\ \ configuration changes.\ntype: \"COMPLIANCE_POLICY\"\ncategories:\n - \"SECURITY\"\ \nframeworkMappings:\n - \"/frameworks/cloudaware/logging-and-monitoring/logging-and-monitoring-configuration\"\ \n - \"/frameworks/aws-fsbp-v1.0.0/mq/02\"\nsimilarPolicies:\n awsSecurityHub:\n\ \ - name: \"[MQ.2] ActiveMQ brokers should stream audit logs to CloudWatch\"\ \n url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/mq-controls.html#mq-2\"" - path: /ce/ca/aws/mq/broker-logging/prod.logic.yaml md5Hash: 4A0A2DDD5E4F8CFCEC8EB1B69AD890B9 content: | --- inputType: "CA10__CaAwsMqBroker__c" importExtracts: - file: "/types/CA10__CaAwsMqBroker__c/object.extracts.yaml" testData: - file: "test-data.json" conditions: - status: "INAPPLICABLE" currentStateMessage: "Audit logging is only supported for ActiveMQ brokers." check: NOT_EQUAL: left: EXTRACT: "CA10__engineType__c" right: TEXT: "ACTIVEMQ" - status: "UNDETERMINED" currentStateMessage: "Unable to determine audit logging status for this ActiveMQ broker." check: IS_EMPTY: arg: EXTRACT: "CA10__logsAudit__c" - status: "INCOMPLIANT" currentStateMessage: "Audit logging is disabled for this ActiveMQ broker." remediationMessage: "Enable audit logging in the broker's log configuration settings." check: IS_EQUAL: left: EXTRACT: "CA10__logsAudit__c" right: TEXT: "Disabled" - status: "COMPLIANT" currentStateMessage: "Audit logging is enabled for the ActiveMQ broker." check: IS_EQUAL: left: EXTRACT: "CA10__logsAudit__c" right: TEXT: "Enabled" otherwise: status: "UNDETERMINED" currentStateMessage: "Unexpected values in the field." - path: /ce/ca/aws/mq/broker-logging/test-data.json md5Hash: 6A079605CC2183F1238C0A8CFF6B736A content: |- [ { "expectedResult": { "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "runtimeError": null }, "context": { "snapshotTime": "2026-01-14T11:34:06Z" }, "CA10__disappearanceTime__c": "2026-01-14T11:34:06Z", "CA10__engineType__c": "ActiveMQ", "CA10__logsAudit__c": "Disabled", "Id": "test1" }, { "expectedResult": { "status": "INAPPLICABLE", "conditionIndex": "199", "conditionText": "extract('CA10__engineType__c') != 'ACTIVEMQ'", "runtimeError": null }, "context": { "snapshotTime": "2026-01-14T11:34:06Z" }, "CA10__disappearanceTime__c": null, "CA10__engineType__c": "RabbitMQ", "CA10__logsAudit__c": "Disabled", "Id": "test2" }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "399", "conditionText": "extract('CA10__logsAudit__c') == 'Disabled'", "runtimeError": null }, "context": { "snapshotTime": "2026-01-14T11:34:06Z" }, "CA10__disappearanceTime__c": null, "CA10__engineType__c": "ActiveMQ", "CA10__logsAudit__c": "Disabled", "Id": "test3" }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "499", "conditionText": "extract('CA10__logsAudit__c') == 'Enabled'", "runtimeError": null }, "context": { "snapshotTime": "2026-01-14T11:34:06Z" }, "CA10__disappearanceTime__c": null, "CA10__engineType__c": "ActiveMQ", "CA10__logsAudit__c": "Enabled", "Id": "test4" } ] - path: /types/CA10__CaAwsMqBroker__c/object.extracts.yaml md5Hash: 1D91E5184493B4B1AF50FC5A1E53B744 content: "---\nextracts:\n # Checkbox.\n - name: CA10__publiclyAccessible__c\n\ \ value: \n FIELD:\n path: CA10__publiclyAccessible__c\n # Checkbox.\n\ \ - name: CA10__autoMinorVersionUpgrade__c\n value: \n FIELD:\n \ \ path: CA10__autoMinorVersionUpgrade__c\n # Text.\n - name: CA10__deploymentMode__c\n\ \ value: \n FIELD:\n path: CA10__deploymentMode__c\n# Values:\ \ Enabled | Disabled. Nullable.\n - name: \"CA10__logsAudit__c\"\n value:\ \ \n FIELD:\n path: \"CA10__logsAudit__c\"\n# Values: ACTIVEMQ |\ \ RABBITMQ. Not nullable. \n - name: \"CA10__engineType__c\"\n value: \n\ \ FIELD:\n path: \"CA10__engineType__c\"\n undeterminedIf:\n\ \ noAccessDelegate:\n path: \"CA10__engineType__c\"\n \ \ currentStateMessage: \"Broker Engine type cannot be empty. Possible\ \ permission issue with mq:DescribeBroker.\"\n" script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "test1", "expectedResult" : { "status" : "DISAPPEARED", "conditionIndex" : "99", "conditionText" : "isDisappeared(CA10__disappearanceTime__c)", "runtimeError" : null } }, { "Id" : "test2", "expectedResult" : { "status" : "INAPPLICABLE", "conditionIndex" : "199", "conditionText" : "extract('CA10__engineType__c') != 'ACTIVEMQ'", "runtimeError" : null } }, { "Id" : "test3", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "399", "conditionText" : "extract('CA10__logsAudit__c') == 'Disabled'", "runtimeError" : null } }, { "Id" : "test4", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "499", "conditionText" : "extract('CA10__logsAudit__c') == 'Enabled'", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsMqBroker__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2026-01-14T11:34:06Z") }, "CA10__disappearanceTime__c" : new Date("2026-01-14T11:34:06Z"), "CA10__engineType__c" : "ActiveMQ", "CA10__logsAudit__c" : "Disabled", "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2026-01-14T11:34:06Z") }, "CA10__engineType__c" : "RabbitMQ", "CA10__logsAudit__c" : "Disabled", "Id" : "test2" }, { "context" : { "snapshotTime" : new Date("2026-01-14T11:34:06Z") }, "CA10__engineType__c" : "ActiveMQ", "CA10__logsAudit__c" : "Disabled", "Id" : "test3" }, { "context" : { "snapshotTime" : new Date("2026-01-14T11:34:06Z") }, "CA10__engineType__c" : "ActiveMQ", "CA10__logsAudit__c" : "Enabled", "Id" : "test4" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsMqBroker__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__engineType__c STRING, CA10__logsAudit__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__engineType__c)) { throw new Error("UNDETERMINED condition:101", {cause: {status: 'UNDETERMINED', conditionIndex: 101, conditionText: "CA10__engineType__c.delegatedTo(CA10__engineType__c).isEmpty()", currentStateMessage: "Broker Engine type cannot be empty. Possible permission issue with mq:DescribeBroker.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__engineType__c; } function extract3() { if (!this.out) { this.out = fieldChecked4(); } return this.out; }; references1.push('Engine Type [obj.CA10__engineType__c]: ' + obj.CA10__engineType__c); try { if (TextLib.notEqual(extract3.call(extract3), 'ACTIVEMQ')) { return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "extract('CA10__engineType__c') != 'ACTIVEMQ'", currentStateMessage: "Audit logging is only supported for ActiveMQ brokers.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[2], conditionIndex:[200..299] function extract6() { if (!this.out) { this.out = obj.CA10__logsAudit__c; } return this.out; }; references1.push('Logs: Audit [obj.CA10__logsAudit__c]: ' + obj.CA10__logsAudit__c); if (TextLib.isEmpty(extract6.call(extract6))) { return {status: 'UNDETERMINED', conditionIndex: 299, conditionText: "extract('CA10__logsAudit__c').isEmpty()", currentStateMessage: "Unable to determine audit logging status for this ActiveMQ broker.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[3], conditionIndex:[300..399] function extract9() { if (!this.out) { this.out = obj.CA10__logsAudit__c; } return this.out; }; if (TextLib.equal(extract9.call(extract9), 'Disabled')) { return {status: 'INCOMPLIANT', conditionIndex: 399, conditionText: "extract('CA10__logsAudit__c') == 'Disabled'", currentStateMessage: "Audit logging is disabled for this ActiveMQ broker.", currentStateReferences: references1.join('\n'), remediation: "Enable audit logging in the broker's log configuration settings.", runtimeError: null}; } // condition[4], conditionIndex:[400..499] function extract12() { if (!this.out) { this.out = obj.CA10__logsAudit__c; } return this.out; }; if (TextLib.equal(extract12.call(extract12), 'Enabled')) { return {status: 'COMPLIANT', conditionIndex: 499, conditionText: "extract('CA10__logsAudit__c') == 'Enabled'", currentStateMessage: "Audit logging is enabled for the ActiveMQ broker.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'UNDETERMINED', conditionIndex: 500, conditionText: "otherwise", currentStateMessage: "Unexpected values in the field.", 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__engineType__c AS CA10__engineType__c, sObject.CA10__logsAudit__c AS CA10__logsAudit__c, sObject.Id AS Id, process_CA10__CaAwsMqBroker__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__engineType__c AS CA10__engineType__c, sObject.CA10__logsAudit__c AS CA10__logsAudit__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsMqBroker__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;