Coding agent

How to security test an app built with Windsurf

Updated

Windsurf's agent works from intent, so it fills gaps with plausible assumptions — usually that the current user owns whatever id is in the request. Test those assumptions on every data path it touched, and review what it executed in your environment.

Where this class of bug actually lives in Windsurf output

  • Ownership assumptions. The agent assumes the record belongs to the current user because that is the common case.
  • Schema and migration changes. An added column or index is fine; a dropped constraint is not, and it does not appear in the app diff.
  • Commands run in the environment. Package installs, migrations and scripts executed with your credentials.
  • Config edits. Env files, CI definitions and deploy settings that the agent adjusts to make the build pass.

What to try first

  1. List every file the agent changed, including migrations and config, not just source.
  2. Test each data path it touched with two accounts.
  3. Check the shell history or the agent log for commands that changed persistent state.
  4. Diff the migrations for removed constraints and indexes.

A reproduction you can keep

Start from the change set, then test the ownership assumption directly:

Ownership assumption on a touched path
git diff --stat main            # include migrations and config
git diff main -- migrations/    # removed constraints live here

curl -sS -i https://staging.example.com/api/<touched-route>/1003 \
  -H 'Authorization: Bearer ***'      # second account

# vulnerable: 200 on the foreign id, or a dropped unique index
# fixed: 404, and migrations only add

What "fixed" has to look like

Every data path the agent touched must scope by the session, and migrations must be additive unless the removal was deliberate. Verify with two accounts on each path and by reading the migration diff for dropped constraints.

Where people get this wrong

  • A migration that drops a unique index removes a race-condition defence that no test covers.
  • Commands run by the agent are part of the change and do not appear in a code review.
  • The agent's assumption is invisible in the code because it looks like normal usage.

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

Should I review migrations separately from code?

Yes. Dropped constraints and indexes are security-relevant and invisible in an application diff.

What is the main risk with an agent that runs commands?

Persistent environment changes — installs, migrations and config edits — that no code review sees.

Written by Offense Research, reviewed December 2, 2026. Correct something? Email imran@offenseresearch.com.