Code Room
Vibe codingMediumvc-g518
Subject Ai code reviewLevel Mid–Senior~15 minCommon in Security interviewsIndustries Software development, Technology

Question

This Lambda (Python) was generated to call a partner API. It fetches the API key from Secrets Manager on every request, and a teammate also notices a fallback the AI added. Identify both problems.

python
import boto3sm = boto3.client("secretsmanager") def handler(event, context):    secret = sm.get_secret_value(SecretId="partner-api-key")    api_key = secret["SecretString"] or "sk_test_51HardcodedFallbackKey"    return call_partner(api_key, event["payload"])
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.