---
policy: /ce/ca/aws/s3/bucket-block-public-access
logic: /ce/ca/aws/s3/bucket-block-public-access/prod.logic.yaml
executionTime: 2025-04-24T23:45:07.644808433Z
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: tets2
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 199
      actual: 199
    conditionText:
      expected: extract('CA10__blockPublicAcls__c') != 'Yes' || extract('CA10__blockPublicPolicy__c')
        != 'Yes' || extract('CA10__ignorePublicAcls__c') != 'Yes' || extract('CA10__restrictPublicBuckets__c')
        != 'Yes'
      actual: extract('CA10__blockPublicAcls__c') != 'Yes' || extract('CA10__blockPublicPolicy__c')
        != 'Yes' || extract('CA10__ignorePublicAcls__c') != 'Yes' || extract('CA10__restrictPublicBuckets__c')
        != 'Yes'
    runtimeError: {}
  - id: test3
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 199
      actual: 199
    conditionText:
      expected: extract('CA10__blockPublicAcls__c') != 'Yes' || extract('CA10__blockPublicPolicy__c')
        != 'Yes' || extract('CA10__ignorePublicAcls__c') != 'Yes' || extract('CA10__restrictPublicBuckets__c')
        != 'Yes'
      actual: extract('CA10__blockPublicAcls__c') != 'Yes' || extract('CA10__blockPublicPolicy__c')
        != 'Yes' || extract('CA10__ignorePublicAcls__c') != 'Yes' || extract('CA10__restrictPublicBuckets__c')
        != 'Yes'
    runtimeError: {}
  - id: test4
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 200
      actual: 200
    conditionText:
      expected: otherwise
      actual: otherwise
    runtimeError: {}
usedFiles:
  - path: /ce/ca/aws/s3/bucket-block-public-access/policy.yaml
    md5Hash: 10DBEA61370C3A12018F0409DFE2DDDF
    content: |
      ---
      names:
        full: AWS S3 Bucket is not configured to block public access
        contextual: Bucket is not configured to block public access
      description: "Amazon S3 provides `Block public access (bucket settings)` and `Block\
        \ public access (account settings)` to help you manage public access to Amazon S3\
        \ resources. By default, S3 buckets and objects are created with public access disabled.\
        \ However, an IAM principal with sufficient S3 permissions can enable public access\
        \ at the bucket and/or object level. While enabled, `Block public access (bucket\
        \ settings)` prevents an individual bucket, and its contained objects, from becoming\
        \ publicly accessible. Similarly, `Block public access (account settings)` prevents\
        \ all buckets, and contained objects, from becoming publicly accessible across the\
        \ entire account."
      type: COMPLIANCE_POLICY
      categories:
        - SECURITY
      frameworkMappings:
        - "/frameworks/cis-aws-v5.0.0/02/01/04"
        - "/frameworks/cloudaware/resource-security/public-and-anonymous-access"
        - "/frameworks/aws-fsbp-v1.0.0/s3/01"
      similarPolicies:
        internal:
          - dec-x-ec547a7c
        cloudConformity:
          - url: https://www.trendmicro.com/cloudoneconformity/knowledge-base/aws/S3/bucket-public-access-block.html
            name: Enable S3 Block Public Access for S3 Buckets
  - path: /ce/ca/aws/s3/bucket-block-public-access/prod.logic.yaml
    md5Hash: 4CCA52CA02D0B5D983852F4756A68DE6
    content: |
      ---
      inputType: "CA10__CaAwsBucket__c"
      testData:
        - file: test-data.json
      importExtracts:
        - file: /types/CA10__CaAwsBucket__c/object.extracts.yaml
      conditions:
        - status: "INCOMPLIANT"
          currentStateMessage: "The bucket is not configured to block public access."
          remediationMessage: "Consider configuring the bucket to block public access."
          check:
            OR:
              args:
                - NOT_EQUAL:
                    left:
                      EXTRACT: CA10__blockPublicAcls__c
                    right:
                      TEXT: "Yes"
                - NOT_EQUAL:
                    left:
                      EXTRACT: CA10__blockPublicPolicy__c
                    right:
                      TEXT: "Yes"
                - NOT_EQUAL:
                    left:
                      EXTRACT: CA10__ignorePublicAcls__c
                    right:
                      TEXT: "Yes"
                - NOT_EQUAL:
                    left:
                      EXTRACT: CA10__restrictPublicBuckets__c
                    right:
                      TEXT: "Yes"
      otherwise:
        status: "COMPLIANT"
        currentStateMessage: "The bucket is configured to block public access."
  - path: /types/CA10__CaAwsBucket__c/object.extracts.yaml
    md5Hash: D7F01723B629E0F1265F06B9CE2EDE1F
    content: "---\nextracts:\n# Values: yes, no. Not Nullable.\n  - name: \"CA10__objectLockEnabled__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__objectLockEnabled__c\"\n\
      \        undeterminedIf:\n          noAccessDelegate:\n            path: \"\
      CA10__objectLockEnabled__c\"\n            currentStateMessage: \"Unable to determine\
      \ Object Lock status. Possible permission issue with s3:GetObjectLockConfiguration\"\
      \n          isEmpty: \"Object Lock status is not populated yet\"\n# Nullable.\n\
      \  - name: \"CA10__lifecycleRulesJson__c\"\n    value: \n      FIELD:\n    \
      \    path: \"CA10__lifecycleRulesJson__c\"\n        returnType: BYTES\n    \
      \    # undeterminedIf:\n        #   noAccessDelegate:\n        #     path: \"\
      CA10__lifecycleRulesJson__c\"\n        #     currentStateMessage: \"Unable to\
      \ determine Lifecycle Configuration. Possible permission issue with s3:GetLifecycleConfiguration\"\
      \n# Values: enabled, suspended, off. Not Nullable.\n  - name: \"CA10__versioningStatus__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__versioningStatus__c\"\n \
      \       undeterminedIf:\n          noAccessDelegate:\n            path: \"CA10__versioningStatus__c\"\
      \n            currentStateMessage: \"Unable to determine versioning status.\
      \ Possible permission issue with s3:GetBucketVersioning\"\n          isEmpty:\
      \ \"Status is not populated yet\"\n# Checkbox.\n  - name: \"CA10__versioningMfaDeleteEnabled__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__versioningMfaDeleteEnabled__c\"\
      \n        undeterminedIf:\n          noAccessDelegate:\n            path: \"\
      CA10__versioningStatus__c\"\n            currentStateMessage: \"Unable to determine\
      \ versioning status. Possible permission issue with s3:GetBucketVersioning\"\
      \n# The field can be empty if server access logging is not enabled\n  - name:\
      \ \"CA10__loggingDestinationBucketName__c\"\n    value: \n      FIELD:\n   \
      \     path: \"CA10__loggingDestinationBucketName__c\"\n        # undeterminedIf:\n\
      \        #   noAccessDelegate:\n        #     path: \"CA10__loggingDestinationBucketName__c\"\
      \n        #     currentStateMessage: \"Unable to determine if server access\
      \ logging is enabled. Possible permission issue with s3:GetBucketLogging\"\n\
      # Cloudaware derives this field from CA10__loggingDestinationBucketName__c\n\
      \  - name: \"CA10__loggingDestinationBucketArn__c\"\n    value: \n      FIELD:\n\
      \        path: \"CA10__loggingDestinationBucketArn__c\"\n        undeterminedIf:\n\
      \          noAccessDelegate:\n            path: \"CA10__loggingDestinationBucketName__c\"\
      \n            currentStateMessage: \"Unable to determine if server access logging\
      \ is enabled. Possible permission issue with s3:GetBucketLogging\"\n# This is\
      \ a look up on CA10__CaAwsBucket__c derived from CA10__loggingDestinationBucketName__c\n\
      \  - name: \"CA10__loggingDestinationBucket__c\"\n    value: \n      FIELD:\n\
      \        path: \"CA10__loggingDestinationBucket__c\"\n        undeterminedIf:\n\
      \          noAccessDelegate:\n            path: \"CA10__loggingDestinationBucketName__c\"\
      \n            currentStateMessage: \"Unable to determine if server access logging\
      \ is enabled. Possible permission issue with s3:GetBucketLogging\"\n  - name:\
      \ \"CA10__arn__c\"\n    value: \n      FIELD:\n        path: \"CA10__arn__c\"\
      \n        undeterminedIf:\n          isEmpty: \"Bucket ARN cannot be empty.\
      \ Potential data corruption\"\n  - name: \"caJsonFrom__lifecycleRulesJson__c\"\
      \n    value: \n      JSON_FROM:\n        arg: \n          EXTRACT: \"CA10__lifecycleRulesJson__c\"\
      \n        undeterminedIf:\n          isInvalid: \"S3 Bucket Lifecycle Rules\
      \ JSON is invalid.\"\n# Returns BOOLEAN true if number of enabled lifecycle\
      \ rules more than 0 otherwise returns false\n  - name: \"caJsonQueryBoolean__lifecycleRulesJson_status_enabled__c\"\
      \n    value: \n      JSON_QUERY_BOOLEAN:\n        arg: \n          EXTRACT:\
      \ \"caJsonFrom__lifecycleRulesJson__c\"\n        expression: \"length([?status=='Enabled'])\
      \ > `0`\"\n        undeterminedIf: \n          evaluationError: \"The JSON query\
      \ has failed.\"\n          resultTypeMismatch: \"The JSON query did not return\
      \ a boolean.\"\n  - name: \"CA10__blockPublicAcls__c\"\n    value: \n      FIELD:\n\
      \        path: \"CA10__blockPublicAcls__c\"\n        undeterminedIf:\n     \
      \     noAccessDelegate:\n            path: \"CA10__blockPublicAcls__c\"\n  \
      \          currentStateMessage: \"Unable to determine the bucket policy. Possible\
      \ permission issue with s3:GetBucketPublicAccessBlock\"\n  - name: \"CA10__blockPublicPolicy__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__blockPublicPolicy__c\"\n\
      \        undeterminedIf:\n          noAccessDelegate:\n            path: \"\
      CA10__blockPublicPolicy__c\"\n            currentStateMessage: \"Unable to determine\
      \ the bucket policy. Possible permission issue with s3:GetBucketPublicAccessBlock\"\
      \n  - name: \"CA10__ignorePublicAcls__c\"\n    value: \n      FIELD:\n     \
      \   path: \"CA10__ignorePublicAcls__c\"\n        undeterminedIf:\n         \
      \ noAccessDelegate:\n            path: \"CA10__ignorePublicAcls__c\"\n     \
      \       currentStateMessage: \"Unable to determine the bucket policy. Possible\
      \ permission issue with s3:GetBucketPublicAccessBlock\"\n  - name: \"CA10__restrictPublicBuckets__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__restrictPublicBuckets__c\"\
      \n        undeterminedIf:\n          noAccessDelegate:\n            path: \"\
      CA10__restrictPublicBuckets__c\"\n            currentStateMessage: \"Unable\
      \ to determine the bucket policy. Possible permission issue with s3:GetBucketPublicAccessBlock\"\
      \n# Nullable.\n  - name: \"CA10__policyDocument__c\"\n    value: \n      FIELD:\n\
      \        path: \"CA10__policyDocument__c\"\n        returnType: BYTES\n    \
      \    # undeterminedIf:\n        #   noAccessDelegate:\n        #     path: \"\
      CA10__policyDocument__c\"\n        #     currentStateMessage: \"Unable to determine\
      \ the bucket policy. Possible permission issue with s3:GetBucketPolicy\"\n \
      \ - name: \"caJsonFrom__policyDocument__c\"\n    value: \n      JSON_FROM:\n\
      \        arg: \n          EXTRACT: \"CA10__policyDocument__c\"\n        undeterminedIf:\n\
      \          isInvalid: \"S3 Bucket Policy Document JSON is invalid.\"\n"
  - path: /ce/ca/aws/s3/bucket-block-public-access/test-data.json
    md5Hash: 23E519A2B4E226407F2F8929143A88A3
    content: |
      [
        {
          "expectedResult": {
            "status": "DISAPPEARED",
            "conditionIndex": "99",
            "conditionText": "isDisappeared(CA10__disappearanceTime__c)",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2024-06-17T03:42:47Z" },
          "Id": "test1",
          "CA10__disappearanceTime__c": "2024-06-12T07:46:07Z",
          "CA10__blockPublicAcls__c": "No",
          "CA10__blockPublicPolicy__c": "No",
          "CA10__ignorePublicAcls__c": "No",
          "CA10__restrictPublicBuckets__c": "No"
        },
        {
          "expectedResult": {
            "status": "INCOMPLIANT",
            "conditionIndex": "199",
            "conditionText": "extract('CA10__blockPublicAcls__c') != 'Yes' || extract('CA10__blockPublicPolicy__c') != 'Yes' || extract('CA10__ignorePublicAcls__c') != 'Yes' || extract('CA10__restrictPublicBuckets__c') != 'Yes'",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2024-06-17T03:42:47Z" },
          "Id": "tets2",
          "CA10__disappearanceTime__c": null,
          "CA10__blockPublicAcls__c": "No",
          "CA10__blockPublicPolicy__c": "No",
          "CA10__ignorePublicAcls__c": "No",
          "CA10__restrictPublicBuckets__c": "No"
        },
        {
          "expectedResult": {
            "status": "INCOMPLIANT",
            "conditionIndex": "199",
            "conditionText": "extract('CA10__blockPublicAcls__c') != 'Yes' || extract('CA10__blockPublicPolicy__c') != 'Yes' || extract('CA10__ignorePublicAcls__c') != 'Yes' || extract('CA10__restrictPublicBuckets__c') != 'Yes'",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2024-06-17T03:42:47Z" },
          "Id": "test3",
          "CA10__disappearanceTime__c": null,
          "CA10__blockPublicAcls__c": "Yes",
          "CA10__blockPublicPolicy__c": "No",
          "CA10__ignorePublicAcls__c": "Yes",
          "CA10__restrictPublicBuckets__c": "Yes"
        },
        {
          "expectedResult": {
            "status": "COMPLIANT",
            "conditionIndex": "200",
            "conditionText": "otherwise",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2024-06-17T03:42:47Z" },
          "Id": "test4",
          "CA10__disappearanceTime__c": null,
          "CA10__blockPublicAcls__c": "Yes",
          "CA10__blockPublicPolicy__c": "Yes",
          "CA10__ignorePublicAcls__c": "Yes",
          "CA10__restrictPublicBuckets__c": "Yes"
        }
      ]
script: |-
  CREATE TEMP FUNCTION mock_ExpectedResult()
  RETURNS ARRAY<STRUCT<
          Id STRING,
          expectedResult STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, runtimeError STRING>
      >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "Id" : "test1",
    "expectedResult" : {
      "status" : "DISAPPEARED",
      "conditionIndex" : "99",
      "conditionText" : "isDisappeared(CA10__disappearanceTime__c)",
      "runtimeError" : null
    }
  }, {
    "Id" : "tets2",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "199",
      "conditionText" : "extract('CA10__blockPublicAcls__c') != 'Yes' || extract('CA10__blockPublicPolicy__c') != 'Yes' || extract('CA10__ignorePublicAcls__c') != 'Yes' || extract('CA10__restrictPublicBuckets__c') != 'Yes'",
      "runtimeError" : null
    }
  }, {
    "Id" : "test3",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "199",
      "conditionText" : "extract('CA10__blockPublicAcls__c') != 'Yes' || extract('CA10__blockPublicPolicy__c') != 'Yes' || extract('CA10__ignorePublicAcls__c') != 'Yes' || extract('CA10__restrictPublicBuckets__c') != 'Yes'",
      "runtimeError" : null
    }
  }, {
    "Id" : "test4",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : "200",
      "conditionText" : "otherwise",
      "runtimeError" : null
    }
  } ];
  """;

  CREATE TEMP FUNCTION mock_CA10__CaAwsBucket__c()
  RETURNS ARRAY<STRUCT<
      Id STRING,
      CA10__disappearanceTime__c TIMESTAMP,
      CA10__blockPublicAcls__c STRING,
      CA10__blockPublicPolicy__c STRING,
      CA10__ignorePublicAcls__c STRING,
      CA10__restrictPublicBuckets__c STRING,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2024-06-17T03:42:47Z")
    },
    "Id" : "test1",
    "CA10__disappearanceTime__c" : new Date("2024-06-12T07:46:07Z"),
    "CA10__blockPublicAcls__c" : "No",
    "CA10__blockPublicPolicy__c" : "No",
    "CA10__ignorePublicAcls__c" : "No",
    "CA10__restrictPublicBuckets__c" : "No"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-06-17T03:42:47Z")
    },
    "Id" : "tets2",
    "CA10__blockPublicAcls__c" : "No",
    "CA10__blockPublicPolicy__c" : "No",
    "CA10__ignorePublicAcls__c" : "No",
    "CA10__restrictPublicBuckets__c" : "No"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-06-17T03:42:47Z")
    },
    "Id" : "test3",
    "CA10__blockPublicAcls__c" : "Yes",
    "CA10__blockPublicPolicy__c" : "No",
    "CA10__ignorePublicAcls__c" : "Yes",
    "CA10__restrictPublicBuckets__c" : "Yes"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-06-17T03:42:47Z")
    },
    "Id" : "test4",
    "CA10__blockPublicAcls__c" : "Yes",
    "CA10__blockPublicPolicy__c" : "Yes",
    "CA10__ignorePublicAcls__c" : "Yes",
    "CA10__restrictPublicBuckets__c" : "Yes"
  } ];
  """;

  CREATE TEMP FUNCTION process_CA10__CaAwsBucket__c(
      obj STRUCT<
          Id STRING,
          CA10__disappearanceTime__c TIMESTAMP,
          CA10__blockPublicAcls__c STRING,
          CA10__blockPublicPolicy__c STRING,
          CA10__ignorePublicAcls__c STRING,
          CA10__restrictPublicBuckets__c STRING
      >,
      snapshotTime TIMESTAMP
  )
  RETURNS STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, currentStateMessage STRING, currentStateReferences STRING, remediation STRING, runtimeError STRING>
  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));
          };
      }();
      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__blockPublicAcls__c)) {
              throw new Error("UNDETERMINED condition:101", {cause: {status: 'UNDETERMINED', conditionIndex: 101, conditionText: "CA10__blockPublicAcls__c.delegatedTo(CA10__blockPublicAcls__c).isEmpty()", currentStateMessage: "Unable to determine the bucket policy. Possible permission issue with s3:GetBucketPublicAccessBlock", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10__blockPublicAcls__c;
      }
      function extract3() { if (!this.out) { this.out = fieldChecked4(); } return this.out; };
      function fieldChecked7() {
          if (TextLib.isEmpty(obj.CA10__blockPublicPolicy__c)) {
              throw new Error("UNDETERMINED condition:102", {cause: {status: 'UNDETERMINED', conditionIndex: 102, conditionText: "CA10__blockPublicPolicy__c.delegatedTo(CA10__blockPublicPolicy__c).isEmpty()", currentStateMessage: "Unable to determine the bucket policy. Possible permission issue with s3:GetBucketPublicAccessBlock", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10__blockPublicPolicy__c;
      }
      function extract6() { if (!this.out) { this.out = fieldChecked7(); } return this.out; };
      function fieldChecked10() {
          if (TextLib.isEmpty(obj.CA10__ignorePublicAcls__c)) {
              throw new Error("UNDETERMINED condition:103", {cause: {status: 'UNDETERMINED', conditionIndex: 103, conditionText: "CA10__ignorePublicAcls__c.delegatedTo(CA10__ignorePublicAcls__c).isEmpty()", currentStateMessage: "Unable to determine the bucket policy. Possible permission issue with s3:GetBucketPublicAccessBlock", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10__ignorePublicAcls__c;
      }
      function extract9() { if (!this.out) { this.out = fieldChecked10(); } return this.out; };
      function fieldChecked13() {
          if (TextLib.isEmpty(obj.CA10__restrictPublicBuckets__c)) {
              throw new Error("UNDETERMINED condition:104", {cause: {status: 'UNDETERMINED', conditionIndex: 104, conditionText: "CA10__restrictPublicBuckets__c.delegatedTo(CA10__restrictPublicBuckets__c).isEmpty()", currentStateMessage: "Unable to determine the bucket policy. Possible permission issue with s3:GetBucketPublicAccessBlock", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10__restrictPublicBuckets__c;
      }
      function extract12() { if (!this.out) { this.out = fieldChecked13(); } return this.out; };
      references1.push('Block Public ACLs [obj.CA10__blockPublicAcls__c]: ' + obj.CA10__blockPublicAcls__c);
      references1.push('Block Public Policy [obj.CA10__blockPublicPolicy__c]: ' + obj.CA10__blockPublicPolicy__c);
      references1.push('Ignore Public ACLs [obj.CA10__ignorePublicAcls__c]: ' + obj.CA10__ignorePublicAcls__c);
      references1.push('Restrict Public Buckets [obj.CA10__restrictPublicBuckets__c]: ' + obj.CA10__restrictPublicBuckets__c);
      try {
          if (TextLib.notEqual(extract3.call(extract3), 'Yes') || TextLib.notEqual(extract6.call(extract6), 'Yes') || TextLib.notEqual(extract9.call(extract9), 'Yes') || TextLib.notEqual(extract12.call(extract12), 'Yes')) {
              return {status: 'INCOMPLIANT', conditionIndex: 199, conditionText: "extract('CA10__blockPublicAcls__c') != 'Yes' || extract('CA10__blockPublicPolicy__c') != 'Yes' || extract('CA10__ignorePublicAcls__c') != 'Yes' || extract('CA10__restrictPublicBuckets__c') != 'Yes'", currentStateMessage: "The bucket is not configured to block public access.", currentStateReferences: references1.join('\n'), remediation: "Consider configuring the bucket to block public access.", 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 bucket is configured to block public access.", 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.Id AS Id,
          sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
          sObject.CA10__blockPublicAcls__c AS CA10__blockPublicAcls__c,
          sObject.CA10__blockPublicPolicy__c AS CA10__blockPublicPolicy__c,
          sObject.CA10__ignorePublicAcls__c AS CA10__ignorePublicAcls__c,
          sObject.CA10__restrictPublicBuckets__c AS CA10__restrictPublicBuckets__c,
          process_CA10__CaAwsBucket__c(
              STRUCT(
                  sObject.Id AS Id,
                  sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                  sObject.CA10__blockPublicAcls__c AS CA10__blockPublicAcls__c,
                  sObject.CA10__blockPublicPolicy__c AS CA10__blockPublicPolicy__c,
                  sObject.CA10__ignorePublicAcls__c AS CA10__ignorePublicAcls__c,
                  sObject.CA10__restrictPublicBuckets__c AS CA10__restrictPublicBuckets__c
              ),
              sObject.context.snapshotTime
          ) as result
      FROM UNNEST(mock_CA10__CaAwsBucket__c()) AS sObject
  ) sObject ON sObject.Id = expectedResult.Id;
