---
policy: /ce/ca/aws/lambda/function-iam-policy-public
logic: /ce/ca/aws/lambda/function-iam-policy-public/prod.logic.yaml
executionTime: 2026-01-12T19:24:40.470427904Z
generationMs: 155
executionMs: 1807
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: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 200
      actual: 200
    conditionText:
      expected: otherwise
      actual: otherwise
    runtimeError: {}
  - id: test3
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 200
      actual: 200
    conditionText:
      expected: otherwise
      actual: otherwise
    runtimeError: {}
  - id: test4
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 199
      actual: 199
    conditionText:
      expected: "CA10__iamPolicyExt__c .allows(EXTERNAL_PRINCIPAL, [lambda:InvokeFunction,\
        \ lambda:GetFunction, lambda:UpdateFunctionCode, ... 2 elements])"
      actual: "CA10__iamPolicyExt__c .allows(EXTERNAL_PRINCIPAL, [lambda:InvokeFunction,\
        \ lambda:GetFunction, lambda:UpdateFunctionCode, ... 2 elements])"
    runtimeError: {}
  - id: test5
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 199
      actual: 199
    conditionText:
      expected: "CA10__iamPolicyExt__c .allows(EXTERNAL_PRINCIPAL, [lambda:InvokeFunction,\
        \ lambda:GetFunction, lambda:UpdateFunctionCode, ... 2 elements])"
      actual: "CA10__iamPolicyExt__c .allows(EXTERNAL_PRINCIPAL, [lambda:InvokeFunction,\
        \ lambda:GetFunction, lambda:UpdateFunctionCode, ... 2 elements])"
    runtimeError: {}
usedFiles:
  - path: /ce/ca/aws/lambda/function-iam-policy-public/policy.yaml
    md5Hash: C7539B4BB3C5E112E2E48442B2505255
    content: "---\nnames:\n  full: \"AWS Lambda Function allows public access\"\n\
      \  contextual: \"Function allows public access\"\ndescription: >\n  Ensure that\
      \ AWS Lambda functions are not publicly accessible. Resource-based \n  policies\
      \ for Lambda functions should restrict access to specific AWS accounts, \n \
      \ services, or IAM principals to prevent unauthorized execution and potential\
      \ data exposure.\ntype: \"COMPLIANCE_POLICY\"\ncategories:\n  - \"SECURITY\"\
      \nframeworkMappings:\n  - \"/frameworks/cloudaware/resource-security/public-and-anonymous-access\"\
      \n  - \"/frameworks/aws-fsbp-v1.0.0/lambda/01\"\nsimilarPolicies:\n  awsSecurityHub:\n\
      \    - name: \"[Lambda.1] Lambda function policies should prohibit public access\"\
      \n      url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/lambda-controls.html#lambda-1\""
  - path: /ce/ca/aws/lambda/function-iam-policy-public/prod.logic.yaml
    md5Hash: 9407E795BC8640AFCAB47BA2FF09CE12
    content: |-
      ---
      inputType: "CA10__CaAwsLambdaFunction__c"
      testData:
        - file: "test-data.json"
      conditions:
        - status: "INCOMPLIANT"
          currentStateMessage: "The Lambda Function resource-based policy allows anonymous access."
          remediationMessage: "Modify the function's resource-based policy to remove permissions granted to anonymous principals."
          check:
            AWS_POLICY_ALLOWS:
              policyExtField: "CA10__iamPolicyExt__c"
              widestAcceptableAccessLevel: "EXTERNAL_PRINCIPAL"
              actions:
                - "lambda:InvokeFunction"
                - "lambda:GetFunction"
                - "lambda:UpdateFunctionCode"
                - "lambda:DeleteFunction"
                - "lambda:GetPolicy"
      otherwise:
        status: "COMPLIANT"
        currentStateMessage: "The Lambda Function is not publicly accessible."
  - path: /ce/ca/aws/lambda/function-iam-policy-public/test-data.json
    md5Hash: 10D864AE1CD5DE1BC0AA197B33732DD6
    content: |-
      [
          {
              "expectedResult": {
                  "runtimeError": null,
                  "conditionText": "isDisappeared(CA10__disappearanceTime__c)",
                  "conditionIndex": 99,
                  "status": "DISAPPEARED"
              },
              "context": {
                  "snapshotTime": "2026-01-12T08:31:03Z"
              },
              "Id": "test1",
              "CA10__disappearanceTime__c": "2025-07-29T12:38:18Z",
              "CA10__iamPolicyExt__c": ""
          },
          {
              "expectedResult": {
                  "runtimeError": null,
                  "conditionText": "otherwise",
                  "conditionIndex": 200,
                  "status": "COMPLIANT"
              },
              "context": {
                  "snapshotTime": "2026-01-12T08:31:03Z"
              },
              "Id": "test2",
              "CA10__disappearanceTime__c": null,
              "CA10__iamPolicyExt__c": "{\"Id\":\"Id\",\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"Sid\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"apigateway.amazonaws.com\"},\"Action\":\"lambda:Invoke*\",\"Resource\":\"Resource\",\"Condition\":{\"ArnLike\":{\"AWS:SourceArn\":\"SourceArn\"}},\"AnalyzedResult\":{\"accessLevel\":\"SAME_ACCOUNT\",\"reason\":\"reason\"}}]}"
          },
          {
              "expectedResult": {
                  "runtimeError": null,
                  "conditionText": "otherwise",
                  "conditionIndex": 200,
                  "status": "COMPLIANT"
              },
              "context": {
                  "snapshotTime": "2026-01-12T08:31:03Z"
              },
              "Id": "test3",
              "CA10__disappearanceTime__c": null,
              "CA10__iamPolicyExt__c": ""
          },
          {
              "expectedResult": {
                  "runtimeError": null,
                  "conditionText": "CA10__iamPolicyExt__c .allows(EXTERNAL_PRINCIPAL, [lambda:InvokeFunction, lambda:GetFunction, lambda:UpdateFunctionCode, ... 2 elements])",
                  "conditionIndex": 199,
                  "status": "INCOMPLIANT"
              },
              "context": {
                  "snapshotTime": "2026-01-12T08:31:03Z"
              },
              "Id": "test4",
              "CA10__disappearanceTime__c": null,
              "CA10__iamPolicyExt__c": "{\"Id\":\"Id\",\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":\"*\",\"Action\":\"lambda:Invoke*\",\"Resource\":\"*\",\"AnalyzedResult\":{\"accessLevel\":\"ANONYMOUS_PRINCIPAL\",\"reason\":\"All principals '*' do not restrict access\"}}]}"
          },
          {
              "expectedResult": {
                  "runtimeError": null,
                  "conditionText": "CA10__iamPolicyExt__c .allows(EXTERNAL_PRINCIPAL, [lambda:InvokeFunction, lambda:GetFunction, lambda:UpdateFunctionCode, ... 2 elements])",
                  "conditionIndex": 199,
                  "status": "INCOMPLIANT"
              },
              "context": {
                  "snapshotTime": "2026-01-12T08:31:03Z"
              },
              "Id": "test5",
              "CA10__disappearanceTime__c": null,
              "CA10__iamPolicyExt__c": "{\"Id\":\"Id\",\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"*\"},\"Action\":\"lambda:Invoke*\",\"Resource\":\"*\",\"AnalyzedResult\":{\"accessLevel\":\"ANONYMOUS_PRINCIPAL\",\"reason\":\"All principals '*' do not restrict access\"}}]}"
          }
      ]
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" : {
      "runtimeError" : null,
      "conditionText" : "isDisappeared(CA10__disappearanceTime__c)",
      "conditionIndex" : 99,
      "status" : "DISAPPEARED"
    }
  }, {
    "Id" : "test2",
    "expectedResult" : {
      "runtimeError" : null,
      "conditionText" : "otherwise",
      "conditionIndex" : 200,
      "status" : "COMPLIANT"
    }
  }, {
    "Id" : "test3",
    "expectedResult" : {
      "runtimeError" : null,
      "conditionText" : "otherwise",
      "conditionIndex" : 200,
      "status" : "COMPLIANT"
    }
  }, {
    "Id" : "test4",
    "expectedResult" : {
      "runtimeError" : null,
      "conditionText" : "CA10__iamPolicyExt__c .allows(EXTERNAL_PRINCIPAL, [lambda:InvokeFunction, lambda:GetFunction, lambda:UpdateFunctionCode, ... 2 elements])",
      "conditionIndex" : 199,
      "status" : "INCOMPLIANT"
    }
  }, {
    "Id" : "test5",
    "expectedResult" : {
      "runtimeError" : null,
      "conditionText" : "CA10__iamPolicyExt__c .allows(EXTERNAL_PRINCIPAL, [lambda:InvokeFunction, lambda:GetFunction, lambda:UpdateFunctionCode, ... 2 elements])",
      "conditionIndex" : 199,
      "status" : "INCOMPLIANT"
    }
  } ];
  """;

  CREATE TEMP FUNCTION mock_CA10__CaAwsLambdaFunction__c()
  RETURNS ARRAY<STRUCT<
      CA10__disappearanceTime__c TIMESTAMP,
      CA10__iamPolicyExt__c STRING,
      Id STRING,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2026-01-12T08:31:03Z")
    },
    "CA10__disappearanceTime__c" : new Date("2025-07-29T12:38:18Z"),
    "CA10__iamPolicyExt__c" : "",
    "Id" : "test1"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-12T08:31:03Z")
    },
    "CA10__iamPolicyExt__c" : "{\"Id\":\"Id\",\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"Sid\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"apigateway.amazonaws.com\"},\"Action\":\"lambda:Invoke*\",\"Resource\":\"Resource\",\"Condition\":{\"ArnLike\":{\"AWS:SourceArn\":\"SourceArn\"}},\"AnalyzedResult\":{\"accessLevel\":\"SAME_ACCOUNT\",\"reason\":\"reason\"}}]}",
    "Id" : "test2"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-12T08:31:03Z")
    },
    "CA10__iamPolicyExt__c" : "",
    "Id" : "test3"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-12T08:31:03Z")
    },
    "CA10__iamPolicyExt__c" : "{\"Id\":\"Id\",\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":\"*\",\"Action\":\"lambda:Invoke*\",\"Resource\":\"*\",\"AnalyzedResult\":{\"accessLevel\":\"ANONYMOUS_PRINCIPAL\",\"reason\":\"All principals '*' do not restrict access\"}}]}",
    "Id" : "test4"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-12T08:31:03Z")
    },
    "CA10__iamPolicyExt__c" : "{\"Id\":\"Id\",\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"*\"},\"Action\":\"lambda:Invoke*\",\"Resource\":\"*\",\"AnalyzedResult\":{\"accessLevel\":\"ANONYMOUS_PRINCIPAL\",\"reason\":\"All principals '*' do not restrict access\"}}]}",
    "Id" : "test5"
  } ];
  """;

  CREATE TEMP FUNCTION process_CA10__CaAwsLambdaFunction__c(
      obj STRUCT<
          CA10__disappearanceTime__c TIMESTAMP,
          CA10__iamPolicyExt__c STRING,
          Id 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 AwsPolicyAllows = new function () {
      function accessLevelOrdinal(accessLevel) {
          if (accessLevel === 'NOBODY') {
              return 0;
          } else if (accessLevel === 'SAME_ACCOUNT') {
              return 1;
          } else if (accessLevel === 'SAME_ORG') {
              return 2;
          } else if (accessLevel === 'TRUSTED_PRINCIPAL') {
              return 3;
          } else if (accessLevel === 'AWS_SERVICE') {
              return 4;
          } else if (accessLevel === 'EXTERNAL_PRINCIPAL') {
              return 5;
          } else if (accessLevel === 'ANONYMOUS_PRINCIPAL') {
              return 6;
          } else {
              return 7;
          }
      }
      function ensureArray(obj) {
          if (obj == null) {
              return [];
          } else if (Array.isArray(obj)) {
              return obj;
          } else {
              return [obj];
          }
      }
      function arrayExec(obj, func) {
          if (obj == null) {
              return false;
          } else if (Array.isArray(obj)) {
              for (var i = 0; i < obj.length; i++) {
                  if (func(obj[i], i)) {
                      return true;
                  }
              }
              return false;
          } else {
              return func(obj, 0);
          }
      }
      function wildcardMatches(text, pattern) {
          if (pattern.indexOf("*") === -1) {
              return text.toLowerCase() === pattern.toLowerCase();
          }
          var regex = new RegExp("^" + pattern.toLowerCase().replaceAll("*", ".*") + "$");
          return regex.test(text.toLowerCase());
      }
      function isActionMatches(action, statement) {
          if (statement.Action) {
              let matches = false;
              arrayExec(statement.Action, function (statementAction) {
                  if (wildcardMatches(action, statementAction)) {
                      matches = true;
                      // break;
                      return true;
                  }
              });
              return matches;
          } else if (statement.NotAction) {
              let matches = false;
              arrayExec(statement.NotAction, function (statementAction) {
                  if (wildcardMatches(action, statementAction)) {
                      matches = true;
                      // break;
                      return true;
                  }
              });
              return !matches;
          }
      }
      function allowResources(openedResources, statement, statementIndex) {
          if (statement.Resource) {
              arrayExec(statement.Resource, function (resource) {
                  openedResources.push({
                      allowType: "R",
                      allowResource: resource,
                      allowStatement: statementIndex,
                      accessLevel: statement.AnalyzedResult.accessLevel,
                      accessLevelOrdinal: accessLevelOrdinal(statement.AnalyzedResult.accessLevel)
                  });
              });
          } else if (statement.NotResource) {
              arrayExec(statement.NotResource, function (resource) {
                  openedResources.push({
                      allowType: "NR",
                      allowResource: resource,
                      allowStatement: statementIndex,
                      accessLevel: statement.AnalyzedResult.accessLevel,
                      accessLevelOrdinal: accessLevelOrdinal(statement.AnalyzedResult.accessLevel)
                  });
              });
          }
      }
      function denyResources(openedResources, statement, statementIndex) {
          var denyType, list;
          if (statement.Resource) {
              denyType = "R";
              list = statement.Resource;
          } else if (statement.NotResource) {
              denyType = "NR";
              list = statement.NotResource;
          } else {
              return;
          }
          var closingAccessLevelOrdinal = accessLevelOrdinal(statement.AnalyzedResult.accessLevel);
          arrayExec(list, function (resource) {
              for (var i = 0; i < openedResources.length; i++) {
                  var openedResource = openedResources[i];
                  if (openedResource.accessLevelOrdinal <= closingAccessLevelOrdinal) {
                      // there is no sense processing deny if it is more widely open than the original allow
                      continue;
                  }
                  if (openedResource.allowType === denyType) {
                      if (wildcardMatches(openedResource.allowResource, resource)) {
                          //
                          openedResource.denyStatement = statementIndex;
                          openedResource.denyType = denyType;
                          openedResource.denyResource = resource;
                          openedResource.accessLevel = statement.AnalyzedResult.accessLevel;
                          openedResource.accessLevelOrdinal = closingAccessLevelOrdinal;
                      }
                  } else {
                      if (!wildcardMatches(openedResource.allowResource, resource)) {
                          //
                          openedResource.denyStatement = statementIndex;
                          openedResource.denyType = denyType;
                          openedResource.denyResource = resource;
                          openedResource.accessLevel = statement.AnalyzedResult.accessLevel;
                          openedResource.accessLevelOrdinal = closingAccessLevelOrdinal;
                      }
                  }
              }
          });
      }
      function calculateSingleAccess(policyExt, action) {
          var openedResources = [];
          var result;
          arrayExec(policyExt.Statement, function (statement, statementIndex) {
              if (statement.Effect !== 'Allow') {
                  // we're accumulating only what's allowed
                  return false; // continue;
              }
              if (statement.AnalyzedResult == null) {
                  // we can't analyze the policy without pre-analysis done on the CMDB side
                  result = {
                      accessLevelOrdinal: accessLevelOrdinal("ANONYMOUS_PRINCIPAL"),
                      accessLevel: "ANONYMOUS_PRINCIPAL",
                      reason: 'There is no analyzed result for a statement #' + (statementIndex + 1)
                  };
                  return true; // break;
              }
              if (isActionMatches(action, statement)) {
                  allowResources(openedResources, statement, statementIndex);
              }
          });
          if (result) {
              return [result];
          }
          if (openedResources.length == 0) {
              return [{
                  accessLevelOrdinal: accessLevelOrdinal("NOBODY"),
                  accessLevel: "NOBODY",
                  reason: "Action " + action + " is implicitly denied. None of the statements are matching this action."
              }];
          }
          arrayExec(policyExt.Statement, function (statement, statementIndex) {
              if (statement.Effect !== 'Deny') {
                  // we're accumulating only what's denied
                  return false; // continue;
              }
              if (statement.AnalyzedResult == null) {
                  // we can't analyze the policy without pre-analysis done on the CMDB side
                  result = {
                      accessLevelOrdinal: accessLevelOrdinal("ANONYMOUS_PRINCIPAL"),
                      accessLevel: "ANONYMOUS_PRINCIPAL",
                      reason: 'There is no analyzed result for a statement #' + (statementIndex + 1)
                  };
                  return true; // break;
              }
              if (isActionMatches(action, statement)) {
                  denyResources(openedResources, statement, statementIndex);
              }
          });
          if (result) {
              return [result];
          }
          /**
           * чтобы "закрыть" Allow тебе нужно
           * 1) иметь accessLevel уже чем у Allow
           * 2) закрыть все Resource у Allow своими, которые в Deny
           */
          return openedResources;
      }
      function resourceAccessibleBy(openedResources, widestAcceptableAccessLevel) {
          var ordinal = accessLevelOrdinal(widestAcceptableAccessLevel);
          return openedResources.filter(openedResource => openedResource.accessLevelOrdinal > ordinal);
      }
      this.calculateAccess = function(policyExt, actions, widestAcceptableAccessLevel) {
          var openedResources = [];
          arrayExec(actions, function (action) {
              var actionResult = calculateSingleAccess(policyExt, action);
              if (Array.isArray(actionResult)) {
                  var filtered = resourceAccessibleBy(actionResult, widestAcceptableAccessLevel);
                  if (filtered.length > 0) {
                      var lowestLevel = null;
                      arrayExec(filtered, function (resource) {
                          if (lowestLevel == null) {
                              lowestLevel = resource.accessLevel;
                          } else {
                              var resourceAccessLevelOrdinal = accessLevelOrdinal(resource.accessLevel);
                              var lowestLevelOrdinal = accessLevelOrdinal(lowestLevel);
                              if (resourceAccessLevelOrdinal > lowestLevelOrdinal) {
                                  lowestLevel = resource.accessLevel;
                              }
                          }
                      });
                      openedResources.push({
                          action: action,
                          accessLevel: lowestLevel,
                          accessLevelOrdinal: accessLevelOrdinal(lowestLevel),
                          reason: 'Policy allows action ' + action + ' with access level up to ' + lowestLevel,
                          openedResources: filtered
                      });
                  }
              } else {
                  actionResult.action = action;
                  openedResources.push(actionResult);
              }
          });
          return openedResources;
      }
  }();
      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 awsPolicyAllows4() {
          var policyExt3 = obj.CA10__iamPolicyExt__c;
          if (policyExt3 === '') {
              policyExt3 = '{}';
          }
          var calculated2 = AwsPolicyAllows.calculateAccess(JSON.parse(policyExt3), ['lambda:InvokeFunction', 'lambda:GetFunction', 'lambda:UpdateFunctionCode', 'lambda:DeleteFunction', 'lambda:GetPolicy'], 'EXTERNAL_PRINCIPAL');
          return calculated2.length > 0;
      }
      try {
          if (awsPolicyAllows4()) {
              return {status: 'INCOMPLIANT', conditionIndex: 199, conditionText: "CA10__iamPolicyExt__c .allows(EXTERNAL_PRINCIPAL, [lambda:InvokeFunction, lambda:GetFunction, lambda:UpdateFunctionCode, ... 2 elements])", currentStateMessage: "The Lambda Function resource-based policy allows anonymous access.", currentStateReferences: references1.join('\n'), remediation: "Modify the function's resource-based policy to remove permissions granted to anonymous principals.", 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 Lambda Function is not publicly accessible.", 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__iamPolicyExt__c AS CA10__iamPolicyExt__c,
          sObject.Id AS Id,
          process_CA10__CaAwsLambdaFunction__c(
              STRUCT(
                  sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                  sObject.CA10__iamPolicyExt__c AS CA10__iamPolicyExt__c,
                  sObject.Id AS Id
              ),
              sObject.context.snapshotTime
          ) as result
      FROM UNNEST(mock_CA10__CaAwsLambdaFunction__c()) AS sObject
  ) sObject ON sObject.Id = expectedResult.Id;
