Verify webhook signature security
You're integrating a payment provider and asked an AI agent to implement webhook signature verification in Node. It returned working code: webhooks come in, signatures verify, your tests pass. You don't deeply understand HMAC or the timing details. Before this guards real money flows, how do you verify it's actually secure and not just functional?
Implement
verify_webhook(header: str, computed_sig: str, event_id: str, now_epoch: int, tolerance_seconds: int, seen_event_ids: list[str]) → strExamples
in
["t=1700000000,v1=abc123","abc123","evt_1",1700000010,300,[]]out"accepted"in
["t=1700000000,v1=abc123","abc999","evt_2",1700000010,300,[]]out"bad_signature"in
["t=1700000000,v1=abc123","abc123","evt_3",1700000600,300,[]]out"stale_timestamp"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 18 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.