Code RoomUndefined method in JWT verification
MediumPrep Room Coding #3983

Undefined method in JWT verification

Vibe & agenticSecurityMid–Senior~17 min

An AI agent wrote this Node.js/Express code to verify a JWT before handling a request. It compiles, the import resolves, and a valid token passes. A teammate is about to merge it. What's wrong?

Implement
authorize_token(token: str, expected_signature: str, now_epoch: int) → str
Examples
in["alg=HS256|sub=alice|exp=1700000100|sig=abc123==","abc123==",1700000000]out"ok:alice"
in["alg=HS256|sub=alice|exp=1700000100|sig=forged","abc123==",1700000000]out"reject:signature"
in["alg=none|sub=alice|exp=1700000100|sig=","",1700000000]out"reject:alg"
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 17 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.