--- policy: /ce/ca/aws/rds/cluster-copy-tags-to-snapshot logic: /ce/ca/aws/rds/cluster-copy-tags-to-snapshot/prod.logic.yaml executionTime: 2026-06-06T12:03:12.429936788Z generationMs: 58 executionMs: 1037 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__status__c') != 'available' actual: extract('CA10__status__c') != 'available' runtimeError: {} - id: test3 match: true status: expected: INAPPLICABLE actual: INAPPLICABLE conditionIndex: expected: 299 actual: 299 conditionText: expected: extract('CA10__engine__c') == 'docdb' actual: extract('CA10__engine__c') == 'docdb' runtimeError: {} - id: test4 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 399 actual: 399 conditionText: expected: CA10__copyTagsToSnapshot__c == false actual: CA10__copyTagsToSnapshot__c == false runtimeError: {} - id: test5 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 499 actual: 499 conditionText: expected: CA10__copyTagsToSnapshot__c == true actual: CA10__copyTagsToSnapshot__c == true runtimeError: {} - id: test6 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 499 actual: 499 conditionText: expected: CA10__copyTagsToSnapshot__c == true actual: CA10__copyTagsToSnapshot__c == true runtimeError: {} usedFiles: - path: /ce/ca/aws/rds/cluster-copy-tags-to-snapshot/policy.yaml md5Hash: 1D65643F90B0FF8ABB87BE85A3A0BCB2 content: "---\nnames:\n full: \"AWS RDS Cluster is not configured to copy all\ \ tags to snapshots\"\n contextual: \"Cluster is not configured to copy all\ \ tags to snapshots\"\ndescription: >\n Ensure that RDS DB clusters have the\ \ Copy Tags to Snapshots setting enabled. \n This ensures that database backups\ \ inherit the same metadata as the source cluster, \n which is critical for\ \ accurate cost allocation, security labeling, and maintaining \n access control\ \ boundaries.\ntype: \"COMPLIANCE_POLICY\"\ncategories:\n - \"RELIABILITY\"\ \nframeworkMappings:\n - \"/frameworks/cloudaware/resource-reliability/system-configuration\"\ \n - \"/frameworks/aws-fsbp-v1.0.0/rds/16\"\n - \"/frameworks/aws-fsbp-v1.0.0/rds/47\"\ \n - \"/frameworks/aws-fsbp-v1.0.0/rds/48\"\n - \"/frameworks/aws-fsbp-v1.0.0/neptune/08\"\ \nsimilarPolicies:\n awsSecurityHub:\n - name: \"[RDS.16] Aurora DB clusters\ \ should be configured to copy tags to DB snapshots\"\n url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/rds-controls.html#rds-16\"\ \n - name: \"[RDS.47] RDS for PostgreSQL DB clusters should be configured\ \ to copy tags to DB snapshots\"\n url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/rds-controls.html#rds-47\"\ \n - name: \"[RDS.48] RDS for MySQL DB clusters should be configured to copy\ \ tags to DB snapshots\"\n url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/rds-controls.html#rds-48\"\ \n - name: \"[Neptune.8] Neptune DB clusters should be configured to copy\ \ tags to snapshots\"\n url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/neptune-controls.html#neptune-8\"\ \n" - path: /ce/ca/aws/rds/cluster-copy-tags-to-snapshot/prod.logic.yaml md5Hash: E851A927DC581C31A58BC0AD52953E8D content: "---\ninputType: \"CA10__CaAwsDbCluster__c\"\ntestData:\n - file: \"\ test-data.json\"\nimportExtracts:\n - file: \"/types/CA10__CaAwsDbCluster__c/object.extracts.yaml\"\ \nconditions:\n - status: \"INAPPLICABLE\"\n currentStateMessage: \"The\ \ cluster is not available.\"\n check:\n NOT_EQUAL:\n left:\n\ \ EXTRACT: \"CA10__status__c\"\n right:\n TEXT: \"\ available\"\n - status: \"INAPPLICABLE\"\n currentStateMessage: \"This policy\ \ is not applicable to DocumentDB clusters.\"\n check:\n IS_EQUAL:\n\ \ left:\n EXTRACT: \"CA10__engine__c\"\n right:\n \ \ TEXT: \"docdb\" \n - status: \"INCOMPLIANT\"\n currentStateMessage:\ \ \"The RDS cluster is not configured to copy tags to snapshots.\"\n remediationMessage:\ \ \"Enable copy tags to snapshots for the RDS cluster.\"\n check:\n \ \ IS_EQUAL:\n left:\n FIELD:\n path: \"CA10__copyTagsToSnapshot__c\"\ \n right:\n BOOLEAN: false\n - status: \"COMPLIANT\"\n currentStateMessage:\ \ \"The RDS cluster is configured to copy tags to snapshots.\"\n check:\n\ \ IS_EQUAL:\n left:\n FIELD:\n path: \"CA10__copyTagsToSnapshot__c\"\ \n right:\n BOOLEAN: true\notherwise:\n status: \"UNDETERMINED\"\ \n currentStateMessage: \"Unexpected values in the field.\"\n" - path: /ce/ca/aws/rds/cluster-copy-tags-to-snapshot/test-data.json md5Hash: 0335BA6F502B2B56B349D736F4E5A234 content: | [ { "expectedResult": { "runtimeError": null, "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "conditionIndex": 99, "status": "DISAPPEARED" }, "context": { "snapshotTime": "2026-01-30T10:53:34Z" }, "Id": "test1", "CA10__disappearanceTime__c": "2026-01-20T22:12:18Z", "CA10__copyTagsToSnapshot__c": true, "CA10__engine__c": "mysql", "CA10__status__c": "stopped" }, { "expectedResult": { "runtimeError": null, "conditionText": "extract('CA10__status__c') != 'available'", "conditionIndex": 199, "status": "INAPPLICABLE" }, "context": { "snapshotTime": "2026-01-30T10:53:34Z" }, "Id": "test2", "CA10__disappearanceTime__c": null, "CA10__copyTagsToSnapshot__c": false, "CA10__engine__c": "postgres", "CA10__status__c": "stopped" }, { "expectedResult": { "runtimeError": null, "conditionText": "extract('CA10__engine__c') == 'docdb'", "conditionIndex": 299, "status": "INAPPLICABLE" }, "context": { "snapshotTime": "2026-01-30T10:53:34Z" }, "Id": "test3", "CA10__disappearanceTime__c": null, "CA10__copyTagsToSnapshot__c": false, "CA10__engine__c": "docdb", "CA10__status__c": "available" }, { "expectedResult": { "runtimeError": null, "conditionText": "CA10__copyTagsToSnapshot__c == false", "conditionIndex": 399, "status": "INCOMPLIANT" }, "context": { "snapshotTime": "2026-01-30T10:53:34Z" }, "Id": "test4", "CA10__disappearanceTime__c": null, "CA10__copyTagsToSnapshot__c": false, "CA10__engine__c": "mysql", "CA10__status__c": "available" }, { "expectedResult": { "runtimeError": null, "conditionText": "CA10__copyTagsToSnapshot__c == true", "conditionIndex": 499, "status": "COMPLIANT" }, "context": { "snapshotTime": "2026-01-30T10:53:34Z" }, "Id": "test5", "CA10__disappearanceTime__c": null, "CA10__copyTagsToSnapshot__c": true, "CA10__engine__c": "postgres", "CA10__status__c": "available" }, { "expectedResult": { "runtimeError": null, "conditionText": "CA10__copyTagsToSnapshot__c == true", "conditionIndex": 499, "status": "COMPLIANT" }, "context": { "snapshotTime": "2026-01-30T10:53:34Z" }, "Id": "test6", "CA10__disappearanceTime__c": null, "CA10__copyTagsToSnapshot__c": true, "CA10__engine__c": "aurora-postgresql", "CA10__status__c": "available" } ] - path: /types/CA10__CaAwsDbCluster__c/object.extracts.yaml md5Hash: 8AACD486F39325BBBA7FE4FA3BE340E9 content: | --- extracts: - name: CA10__engine__c value: FIELD: path: CA10__engine__c undeterminedIf: # https://docs.aws.amazon.com/cli/latest/reference/rds/describe-db-clusters.html # "Engine" attribute represents a non-nullable string. isEmpty: DB Engine value cannot be empty. Potential data corruption. # Values: Yes | No. Not nullable. Cannot have no access, retrieved via rds:DescribeDBClusters - name: CA10__autoMinorVersionUpgrade__c value: FIELD: path: CA10__autoMinorVersionUpgrade__c # Number. Can't have no access, retrieved via rds:DescribeDBClusters - name: CA10__backupRetentionPeriod__c value: FIELD: path: CA10__backupRetentionPeriod__c # Number. Can't have no access, retrieved via rds:DescribeDBClusters - name: CA10__backtrackWindow__c value: FIELD: path: CA10__backtrackWindow__c # Checkbox. - name: CA10__multiAZ__c value: FIELD: path: CA10__multiAZ__c # Checkbox. - name: CA10__storageEncrypted__c value: FIELD: path: CA10__storageEncrypted__c # Text. - name: CA10__masterUsername__c value: FIELD: path: CA10__masterUsername__c # Checkbox. - name: CA10__iamDatabaseAuthenticationEnabled__c value: FIELD: path: CA10__iamDatabaseAuthenticationEnabled__c - name: CA10__status__c value: FIELD: path: CA10__status__c undeterminedIf: # https://docs.aws.amazon.com/cli/latest/reference/rds/describe-db-clusters.html # "Engine" attribute represents a non-nullable string. isEmpty: DB Status value cannot be empty. Potential data corruption. # Nullable. Can't have no access, retrieved via rds:DescribeDBClusters - name: CA10__enabledCloudwatchLogsExports__c value: FIELD: path: CA10__enabledCloudwatchLogsExports__c # Checkbox. - name: CA10__copyTagsToSnapshot__c value: FIELD: path: CA10__copyTagsToSnapshot__c script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "test1", "expectedResult" : { "runtimeError" : null, "conditionText" : "isDisappeared(CA10__disappearanceTime__c)", "conditionIndex" : 99, "status" : "DISAPPEARED" } }, { "Id" : "test2", "expectedResult" : { "runtimeError" : null, "conditionText" : "extract('CA10__status__c') != 'available'", "conditionIndex" : 199, "status" : "INAPPLICABLE" } }, { "Id" : "test3", "expectedResult" : { "runtimeError" : null, "conditionText" : "extract('CA10__engine__c') == 'docdb'", "conditionIndex" : 299, "status" : "INAPPLICABLE" } }, { "Id" : "test4", "expectedResult" : { "runtimeError" : null, "conditionText" : "CA10__copyTagsToSnapshot__c == false", "conditionIndex" : 399, "status" : "INCOMPLIANT" } }, { "Id" : "test5", "expectedResult" : { "runtimeError" : null, "conditionText" : "CA10__copyTagsToSnapshot__c == true", "conditionIndex" : 499, "status" : "COMPLIANT" } }, { "Id" : "test6", "expectedResult" : { "runtimeError" : null, "conditionText" : "CA10__copyTagsToSnapshot__c == true", "conditionIndex" : 499, "status" : "COMPLIANT" } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsDbCluster__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2026-01-30T10:53:34Z") }, "CA10__disappearanceTime__c" : new Date("2026-01-20T22:12:18Z"), "CA10__status__c" : "stopped", "CA10__engine__c" : "mysql", "CA10__copyTagsToSnapshot__c" : true, "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2026-01-30T10:53:34Z") }, "CA10__status__c" : "stopped", "CA10__engine__c" : "postgres", "CA10__copyTagsToSnapshot__c" : false, "Id" : "test2" }, { "context" : { "snapshotTime" : new Date("2026-01-30T10:53:34Z") }, "CA10__status__c" : "available", "CA10__engine__c" : "docdb", "CA10__copyTagsToSnapshot__c" : false, "Id" : "test3" }, { "context" : { "snapshotTime" : new Date("2026-01-30T10:53:34Z") }, "CA10__status__c" : "available", "CA10__engine__c" : "mysql", "CA10__copyTagsToSnapshot__c" : false, "Id" : "test4" }, { "context" : { "snapshotTime" : new Date("2026-01-30T10:53:34Z") }, "CA10__status__c" : "available", "CA10__engine__c" : "postgres", "CA10__copyTagsToSnapshot__c" : true, "Id" : "test5" }, { "context" : { "snapshotTime" : new Date("2026-01-30T10:53:34Z") }, "CA10__status__c" : "available", "CA10__engine__c" : "aurora-postgresql", "CA10__copyTagsToSnapshot__c" : true, "Id" : "test6" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsDbCluster__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__status__c STRING, CA10__engine__c STRING, CA10__copyTagsToSnapshot__c BOOLEAN, 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.isEmpty()", currentStateMessage: "DB Status value cannot be empty. Potential data corruption.", 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.notEqual(extract3.call(extract3), 'available')) { return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "extract('CA10__status__c') != 'available'", currentStateMessage: "The cluster is not available.", 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 fieldChecked7() { if (TextLib.isEmpty(obj.CA10__engine__c)) { throw new Error("UNDETERMINED condition:201", {cause: {status: 'UNDETERMINED', conditionIndex: 201, conditionText: "CA10__engine__c.isEmpty()", currentStateMessage: "DB Engine value cannot be empty. Potential data corruption.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__engine__c; } function extract6() { if (!this.out) { this.out = fieldChecked7(); } return this.out; }; references1.push('Engine [obj.CA10__engine__c]: ' + obj.CA10__engine__c); try { if (TextLib.equal(extract6.call(extract6), 'docdb')) { return {status: 'INAPPLICABLE', conditionIndex: 299, conditionText: "extract('CA10__engine__c') == 'docdb'", currentStateMessage: "This policy is not applicable to DocumentDB clusters.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[3], conditionIndex:[300..399] references1.push('Copy Tags to Snapshot [obj.CA10__copyTagsToSnapshot__c]: ' + obj.CA10__copyTagsToSnapshot__c); if (obj.CA10__copyTagsToSnapshot__c == false) { return {status: 'INCOMPLIANT', conditionIndex: 399, conditionText: "CA10__copyTagsToSnapshot__c == false", currentStateMessage: "The RDS cluster is not configured to copy tags to snapshots.", currentStateReferences: references1.join('\n'), remediation: "Enable copy tags to snapshots for the RDS cluster.", runtimeError: null}; } // condition[4], conditionIndex:[400..499] if (obj.CA10__copyTagsToSnapshot__c == true) { return {status: 'COMPLIANT', conditionIndex: 499, conditionText: "CA10__copyTagsToSnapshot__c == true", currentStateMessage: "The RDS cluster is configured to copy tags to snapshots.", 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__status__c AS CA10__status__c, sObject.CA10__engine__c AS CA10__engine__c, sObject.CA10__copyTagsToSnapshot__c AS CA10__copyTagsToSnapshot__c, sObject.Id AS Id, process_CA10__CaAwsDbCluster__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__status__c AS CA10__status__c, sObject.CA10__engine__c AS CA10__engine__c, sObject.CA10__copyTagsToSnapshot__c AS CA10__copyTagsToSnapshot__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsDbCluster__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;