Code written in Cursor is usually correct at the feature level and unchecked at the object level, because the prompt describes what the screen does rather than who may see which row. Test every new route for a missing tenant scope, and every generated find-style lookup with a second account's id.
Where this class of bug actually lives in Cursor-written code
- The generated route handler. Cursor writes
findById(params.id)because that is what the request contains. The tenant filter is an extra sentence someone has to ask for. - Multi-file edits. A refactor that touches eight files updates the happy path in all eight and the permission check in two.
- Copied patterns. It mirrors the file you have open, so one insecure pattern in an existing route propagates to every new one.
- Completion paths. Error branches and empty states are the least-specified, and they are where an unhandled rejection leaks a stack.
What to try first
- Diff every route added in the branch and look for the authorization line, not the business logic.
- Request each new endpoint with the lowest role and with another tenant's id.
- Ask for the same feature in a second place and compare whether the checks match — they usually diverge.
- Check what happens on a malformed body: a 500 with a stack is a free map of the ORM.
A reproduction you can keep
The new route is the target. Two accounts is the test:
# whatever id the generated handler reads from the path
curl -sS -i https://staging.example.com/api/projects/1003 \
-H 'Authorization: Bearer ***' # account B's token
curl -sS -i https://staging.example.com/api/projects/99999999 \
-H 'Authorization: Bearer ***'
# vulnerable: 200 with A's project, 404 for the fake — an id oracle
# fixed: identical 404sWhat "fixed" has to look like
Every generated lookup must be scoped through the session's tenant before it runs, and the pass condition is that a foreign id and a nonexistent id are indistinguishable. Add that as a rule in your project's agent instructions so the next generated route inherits it.
Where people get this wrong
- Asking the agent to "add auth" produces a middleware that checks for a session, not for ownership of the row.
- Accepting a green test suite as proof: the tests cover the prompt, and the prompt did not mention the other tenant.
- One insecure pattern in an open file becomes twenty across the branch.
What Offense does here
Offense runs an agent swarm against your app in a disposable sandbox, keeps the request, the identity and the vulnerable response as evidence, and replays the same attack after the fix so the retest is a control comparison rather than a green check. It does not read your source and it does not patch your code: the finding goes to your coding agent with the reproduction attached. The hosted workspace is invite-only — join the waitlist — and the free dependency audit in /install needs no account.
Questions this page answers
Why does Cursor-written code usually miss authorization?
Because the feature description is about behaviour, not access. The tenant scoping is an instruction nobody gave.
What is the fastest check on a Cursor branch?
Two accounts and one id swap on every new route, then compare against a nonexistent id.
Written by Offense Research, reviewed December 2, 2026. Correct something? Email imran@offenseresearch.com.