Code Room
Vibe codingHardvc-g176
Subject Ai code reviewLevel Senior–Staff~18 minCommon in Algorithms & data structures interviewsIndustries Technology, Software development

Question

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?

hcl
resource "aws_iam_role_policy" "lambda" {  role = aws_iam_role.lambda.id  policy = jsonencode({    Version = "2012-10-17"    Statement = [{      Effect   = "Allow"      Action   = ["kms:*", "s3:*"]      Resource = "*"    }]  })}
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.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.