--- policy: /ce/ca/aws/rds/cluster-deletion-protection logic: /ce/ca/aws/rds/cluster-deletion-protection/prod.logic.yaml executionTime: 2026-02-10T22:33:09.162878036Z generationMs: 58 executionMs: 765 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: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 199 actual: 199 conditionText: expected: CA10__deletionProtection__c == false actual: CA10__deletionProtection__c == false runtimeError: {} - id: test3 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 299 actual: 299 conditionText: expected: CA10__deletionProtection__c == true actual: CA10__deletionProtection__c == true runtimeError: {} usedFiles: - path: /ce/ca/aws/rds/cluster-deletion-protection/policy.yaml md5Hash: 065D5D56A91D0F55F1B807D110A5A1D7 content: "---\nnames:\n full: \"AWS RDS Cluster Deletion Protection is not enabled\"\ \n contextual: \"Cluster Deletion Protection is not enabled\"\ndescription:\ \ >\n Ensure that Amazon RDS clusters have deletion protection enabled. This\ \ feature \n prevents the database from being accidentally deleted by any user\ \ or process, \n providing an essential safety net for critical data.\ntype:\ \ \"COMPLIANCE_POLICY\"\ncategories:\n - \"SECURITY\"\nframeworkMappings:\n\ \ - \"/frameworks/cloudaware/resource-security/data-protection-and-recovery\"\ \n - \"/frameworks/aws-fsbp-v1.0.0/rds/07\"\n - \"/frameworks/aws-fsbp-v1.0.0/documentdb/05\"\ \n - \"/frameworks/aws-fsbp-v1.0.0/neptune/04\"\nsimilarPolicies:\n awsSecurityHub:\n\ \ - name: \"[RDS.7] RDS clusters should have deletion protection enabled\"\ \n url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/rds-controls.html#rds-7\"\ \n - name: \"[DocumentDB.5] Amazon DocumentDB clusters should have deletion\ \ protection enabled\" \n url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/documentdb-controls.html#documentdb-5\"\ \n - name: \"[Neptune.4] Neptune DB clusters should have deletion protection\ \ enabled\" \n url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/neptune-controls.html#neptune-4\"\ \n" - path: /ce/ca/aws/rds/cluster-deletion-protection/prod.logic.yaml md5Hash: 478B13F28E71025EA320844BA0E44DF7 content: | --- inputType: "CA10__CaAwsDbCluster__c" testData: - file: test-data.json importExtracts: - file: /types/CA10__CaAwsDbCluster__c/object.extracts.yaml conditions: - status: "INCOMPLIANT" currentStateMessage: "Cluster deletion protection is disabled." remediationMessage: "Enable deletion protection in the cluster configuration settings." check: IS_EQUAL: left: FIELD: path: "CA10__deletionProtection__c" right: BOOLEAN: false - status: "COMPLIANT" currentStateMessage: "Cluster deletion protection is enabled." check: IS_EQUAL: left: FIELD: path: "CA10__deletionProtection__c" right: BOOLEAN: true otherwise: status: "UNDETERMINED" currentStateMessage: "Unexpected values in the field." - path: /ce/ca/aws/rds/cluster-deletion-protection/test-data.json md5Hash: EE8D0EAC6BE1FB614D61E2A59C045D8D content: |- [ { "CA10__deletionProtection__c": false, "expectedResult": { "runtimeError": null, "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "conditionIndex": 99, "status": "DISAPPEARED" }, "context": { "snapshotTime": "2026-01-29T05:20:53Z" }, "Id": "test1", "CA10__disappearanceTime__c": "2026-01-20T22:12:18Z" }, { "CA10__deletionProtection__c": false, "expectedResult": { "runtimeError": null, "conditionText": "CA10__deletionProtection__c == false", "conditionIndex": 199, "status": "INCOMPLIANT" }, "context": { "snapshotTime": "2026-01-29T05:20:53Z" }, "Id": "test2", "CA10__disappearanceTime__c": null }, { "CA10__deletionProtection__c": true, "expectedResult": { "runtimeError": null, "conditionText": "CA10__deletionProtection__c == true", "conditionIndex": 299, "status": "COMPLIANT" }, "context": { "snapshotTime": "2026-01-29T05:20:53Z" }, "Id": "test3", "CA10__disappearanceTime__c": null } ] - path: /types/CA10__CaAwsDbCluster__c/object.extracts.yaml md5Hash: D2C2C5F972AEC114F6BD57EB74FA57CB 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 # 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" : "CA10__deletionProtection__c == false", "conditionIndex" : 199, "status" : "INCOMPLIANT" } }, { "Id" : "test3", "expectedResult" : { "runtimeError" : null, "conditionText" : "CA10__deletionProtection__c == true", "conditionIndex" : 299, "status" : "COMPLIANT" } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsDbCluster__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2026-01-29T05:20:53Z") }, "CA10__disappearanceTime__c" : new Date("2026-01-20T22:12:18Z"), "CA10__deletionProtection__c" : false, "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2026-01-29T05:20:53Z") }, "CA10__deletionProtection__c" : false, "Id" : "test2" }, { "context" : { "snapshotTime" : new Date("2026-01-29T05:20:53Z") }, "CA10__deletionProtection__c" : true, "Id" : "test3" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsDbCluster__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__deletionProtection__c BOOLEAN, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" 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] references1.push('Deletion Protection [obj.CA10__deletionProtection__c]: ' + obj.CA10__deletionProtection__c); if (obj.CA10__deletionProtection__c == false) { return {status: 'INCOMPLIANT', conditionIndex: 199, conditionText: "CA10__deletionProtection__c == false", currentStateMessage: "Cluster deletion protection is disabled.", currentStateReferences: references1.join('\n'), remediation: "Enable deletion protection in the cluster configuration settings.", runtimeError: null}; } // condition[2], conditionIndex:[200..299] if (obj.CA10__deletionProtection__c == true) { return {status: 'COMPLIANT', conditionIndex: 299, conditionText: "CA10__deletionProtection__c == true", currentStateMessage: "Cluster deletion protection is enabled.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'UNDETERMINED', conditionIndex: 300, 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__deletionProtection__c AS CA10__deletionProtection__c, sObject.Id AS Id, process_CA10__CaAwsDbCluster__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__deletionProtection__c AS CA10__deletionProtection__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsDbCluster__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;