Flaws that pass code review
- Authorisation that looks complete in the diff but is missing in one handler, because the assistant copied a neighbouring route that predates the team's auth helper.
- String-built queries or shell commands that the assistant wrote in a familiar style from older code it has seen.
- Plausible but outdated library usage, such as deprecated crypto or JWT verification without algorithm pinning.
- Overly broad CORS, debug flags and permissive defaults kept from a scaffolding step.
- Tests generated alongside the code that assert the happy path and nothing else.
Why runtime testing complements review
Reviewers judge whether code looks right; a dynamic test checks whether the running system behaves right. Authorisation bugs in particular are spread across routers, middleware, database rules and gateways, so no single diff shows them. Sending real requests with the wrong user, the wrong role or no token at all exercises the whole chain at once. That is the class of bug most worth catching before release, and the class that static review misses most.
Supply-chain risks that need other tools
Assistants sometimes suggest packages that do not exist, and anyone can register those names in a public registry with malicious code, a risk often called slopsquatting. They can also pin vulnerable versions. A black-box test will not see either until it causes a reachable bug, so lockfile review and dependency scanning stay essential.
Putting Pentest-Swarm in an AI-assisted workflow
Pentest-Swarm tests your staging environment over HTTP after each deploy, independent of how the code was written.
- Run the ci-cd-security playbook against $STAGING_URL in your pipeline; it is built to be fast and scriptable, with SARIF output.
- A GitHub Action (beta) is included for wiring it into pull-request or deploy workflows.
- Give it tokens for two roles so new endpoints are tested for BOLA and BFLA automatically.
- Use
--budgetto cap model spend per run, or a local model for zero API cost. - Findings are verified with non-LLM oracles where possible, which keeps false positives out of developers' queues.
Where it falls short
Dynamic testing cannot see code that is not deployed or not reachable, and it does not explain why the generated code is wrong, only that the behaviour is. Keep SAST and secret scanning on every pull request, and keep human review for authentication and payment code. Pentest-Swarm is alpha software; treat it as one layer of a testing programme.
Questions
Is AI-generated code less secure than human code?
Research results vary and depend on the model, prompt and reviewer. The practical problem is volume: more code shipped per reviewer-hour means more chances for a missed check.
Should we scan every pull request with a pentester?
Run SAST on every pull request, and run a dynamic test against staging on each deploy or nightly. A full autonomous pentest per commit is usually too slow.
Can Pentest-Swarm review the generated code itself?
No, it is a black-box tester and works against the running app. Use a SAST tool for the code.