IAM policy over-scoped wildcard
You told an AI "give the Lambda permission to decrypt with our KMS key and read the uploads bucket." It produced this IAM policy. It works and the Lambda runs. A cloud-security review fails it. What's over-scoped, and what's the subtle correctness risk?
Implement
excess_allowed_actions(granted_patterns: list[str], catalog: list[str], needed_actions: list[str]) → list[str]Examples
in
[["kms:*","s3:*"],["kms:Decrypt","kms:Encrypt","kms:ScheduleKeyDeletion","kms:PutKeyPolicy","s3:GetObject","s3:ListBucket","s3:DeleteObject","s3:PutBucketPolicy"],["kms:Decrypt","s3:GetObject","s3:ListBucket"]]out["kms:Encrypt","kms:ScheduleKeyDeletion","kms:PutKeyPolicy","s3:DeleteObject","s3:PutBucketPolicy"]in
[["kms:Decrypt","s3:GetObject","s3:ListBucket"],["kms:Decrypt","kms:Encrypt","kms:ScheduleKeyDeletion","kms:PutKeyPolicy","s3:GetObject","s3:ListBucket","s3:DeleteObject","s3:PutBucketPolicy"],["kms:Decrypt","s3:GetObject","s3:ListBucket"]]out[]What a strong answer looks like
Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.
0:00 of about 18 min
Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.
Run or narrate your approach, then ask the coach.