TL;DR
AI editors love exec() with a template string, because that is what most tutorials show.
Drop one user-controlled variable into that string and you have remote command execution.
Switch to execFile/spawn with an argument array so no shell ever parses the input.
I asked Cursor to add an image thumbnail endpoint to a side project last week. It gave me working code in about four seconds. It also gave me a way for any user to run shell commands on my server.







