Awesome Reviewers

When granting permissions across AWS services (S3→SQS, EventBridge→Lambda, etc.), use the correct permission model and apply least-privilege constraints to prevent confused-deputy and silent authorization failures.

Apply this checklist: 1) Use resource-based permissions for the target

2) Never use overly broad principals in cross-service queue/object policies

3) Constrain cross-service grants with SourceArn + SourceAccount

4) Scope IAM wildcards to concrete resources

Example: S3 notifications to SQS (confused-deputy hardening)

SentinelSQSQueuePolicy:
  Type: AWS::SQS::QueuePolicy
  Properties:
    Queues:
      - !Ref SentinelSQSQueue
    PolicyDocument:
      Version: '2012-10-17'
      Statement:
        - Sid: AllowS3ToSendMessages
          Effect: Allow
          Principal:
            Service: s3.amazonaws.com
          Action: SQS:SendMessage
          Resource: !GetAtt SentinelSQSQueue.Arn
          Condition:
            ArnLike:
              aws:SourceArn: !Sub arn:${AWS::Partition}:s3:::${LogBucketName}
            StringEquals:
              aws:SourceAccount: !Ref AWS::AccountId

Example: EventBridge invoking Lambda (correct permission mechanism)

EventInvokePermission:
  Type: AWS::Lambda::Permission
  Properties:
    Action: lambda:InvokeFunction
    FunctionName: !GetAtt ExporterLambda.Arn
    Principal: events.amazonaws.com
    SourceArn: !Ref EventBridgeRuleArn

Result: fewer authorization surprises, reduced privilege, and protection against cross-service abuse patterns.