Code Room
Vibe codingMediumvc-g024
Subject Ai code reviewLevel Mid–Senior~16 minCommon in Security interviewsIndustries Software development

Question

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.

typescript
import express from "express";const app = express();app.use(express.json()); app.post("/api/evaluate", (req, res) => {  const { expression } = req.body as { expression: string };  // Compute the user's formula  const result = eval(expression);  res.json({ result });});
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.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.