Code Room
Vibe codingHardvc-g356
Subject Ai code reviewLevel Senior–Staff~20 minCommon in Security interviewsIndustries Computer games, Software development

Question

For a competitive multiplayer shooter, an AI assistant wrote this Node.js server handler for player movement. It works in playtests, but within a week of release speedhackers and teleporters are everywhere. Review the handler and explain why the design is fundamentally cheatable, not just under-validated.

javascript
socket.on('move', (msg) => {  const player = players[socket.id];  // client sends its new authoritative position each tick  player.x = msg.x;  player.y = msg.y;  player.z = msg.z;  player.vx = msg.vx;  player.vz = msg.vz;  broadcastToRoom(player.room, { id: socket.id, ...msg });});
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.