Coding agent

How to security test an app built with Codex

Updated

Codex output tends to compile, pass its own tests and uses idiomatic libraries, so the risk is in choices rather than syntax: a dependency that is unfamiliar or unpinned, an environment assumption baked into a config default, and an authorization check left to the caller.

Where this class of bug actually lives in Codex output

  • Dependency additions. A new package for a small job, sometimes a name close to a popular one, and often unpinned.
  • Config defaults. Permissive CORS, debug on, a wildcard origin, or a secret read from an environment variable with an insecure fallback.
  • Authorization placement. Correct at the entry point and absent from the second code path the same feature uses.
  • Generated tests. They assert the behaviour the issue described and nothing about access.

What to try first

  1. Read the dependency diff and check each new package's publisher, download count and repository before merging.
  2. Grep the diff for CORS, debug flags, and env vars with fallbacks.
  3. Exercise the feature on both code paths the issue created, with two accounts.
  4. Check that the new tests would fail if the access check were removed.

A reproduction you can keep

Dependency and config checks are static; the authorization check needs a request:

New dependency, new surface
git diff main -- package.json package-lock.json | grep '^+'

# any new package: who publishes it, and when
npm view <new-package> maintainers time.modified repository.url

# permissive CORS in the diff
git diff main | grep -iE 'cors|origin|\*'

# the access check, two accounts
curl -sS -i https://staging.example.com/api/<new-route>/1003 -H 'Authorization: Bearer ***'

# vulnerable: unknown publisher, Access-Control-Allow-Origin: *, 200 on the foreign id
# fixed: known package, explicit origin, 404

What "fixed" has to look like

Pin and review every added dependency, replace permissive defaults with explicit values, and scope the new data path the same way as the old one. Verify the authorization fix by confirming the new test fails when the check is removed.

Where people get this wrong

  • A dependency that installs cleanly and passes tests can still be a typosquat of a popular name.
  • Generated tests assert the issue's acceptance criteria. If access was not in the issue, it is not in the tests.
  • A permissive default introduced in a config file is invisible in review unless you grep for it.

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

What is the main risk in Codex-generated PRs?

Choices, not syntax: dependencies, configuration defaults and where the authorization check landed.

How do I check generated tests cover authorization?

Delete the access check locally and run them. If they still pass, they do not cover it.

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