Code RoomJSON serialization visibility and secrets
MediumPrep Room Coding #4069

JSON serialization visibility and secrets

Vibe & agenticAlgorithms & data structuresMid–Senior~14 min

An AI assistant wrote this Go struct and handler to expose a user record over JSON. After release, the frontend reports that `email` and `role` are always missing, and a security reviewer flags a separate issue.

What's wrong with the serialization, and what's the security problem?

Implement
safe_json_keys(field_lines: list[str], allowed_keys: list[str]) → list[str]
Examples
in[["ID|","email|","Role|-","Password|password","CreatedAt|created_at"],["ID","email","Role","password","created_at"]]out["ID","password","created_at"]
in[["ID|id","Email|email","Role|role","PasswordHash|-","CreatedAt|created_at"],["id","email","role","created_at"]]out["id","email","role","created_at"]
in[["ID|id","Password|password"],["id"]]out["id"]
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 14 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.