Hardcoded credentials in generated scripts
You asked an AI assistant to write a quick Python script that pulls rows from your Postgres database and emails a daily report. It produced working code, you ran it, it worked, and you're about to commit. Before you do, what is the one security thing you should scan the diff for first — and where in this kind of generated code does it most often hide?
Implement
find_hardcoded_secrets(diff_lines: list[str]) → list[str]Examples
in
[["+db_password = \"Pr0d-Rds-9f2c!\"","-db_password = \"old\""," conn = connect()"]]out["db_password"]in
[["+db_password = os.environ[\"DB_PASSWORD\"]","+api_key=\"\"","+timeout = 30"]]out[]in
[["+conn = psycopg2.connect(","+ user=\"report_bot\", password=\"Pr0d-Rds-9f2c!\")"]]out["password"]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 10 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.