Code RoomArbitrary code execution via eval
MediumPrep Room Coding #3992

Arbitrary code execution via eval

Vibe & agenticSecurityMid–Senior~16 min

An AI assistant built this TypeScript endpoint for a 'custom formula' feature: users type a math expression in the UI and the server computes the result. It works for inputs like `2 * (3 + 4)`. Review it before it ships to all customers.

Implement
evaluate_expression(expression: str) → list[int]
Examples
in["2 * (3 + 4)"]out[14]
in["require('child_process')"]out[]
in["10 - 2 - 3"]out[5]
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 16 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.