Security audits
How to Audit Code with AI: A Reviewable Workflow
An AI-assisted security audit is useful when it produces evidence a developer can check. A convincing explanation alone is not a verified vulnerability. Start with a bounded repository review, record what was inspected, and keep the final decision with a human reviewer.
Define the audit boundary before scanning
Identify the repository revision, relevant directories, deployment assumptions, and sensitive workflows. Authentication, authorization, file uploads, payment callbacks, and administrative actions often deserve explicit attention.
Ask the reviewer to distinguish application-code findings from dependency advisories and configuration concerns. This prevents a long list of package warnings from hiding a smaller number of important application defects.
- State which files and generated directories are excluded.
- Describe the trust boundaries and attacker-controlled inputs.
- Provide environment-variable names, not production secret values.
- Require the report to identify unreviewed areas and blocked checks.
Establish a baseline in an isolated environment
Record the project’s existing build, lint, and test results before making changes. Repository scripts and dependency installation can execute code, so review them and use an isolated environment without production credentials.
For an npm project, an advisory check can complement source review. Its output reports known dependency advisories; it does not establish whether every advisory is exploitable in your application or whether the application has no other vulnerabilities.
npm audit --jsonRequire evidence for every finding
Each finding should connect an input or configuration to a concrete security consequence. Ask for the affected file and line, the relevant code path, reproduction conditions, and the smallest practical remediation.
Separate confirmed behavior from hypotheses. A suspicious SQL construction, for example, needs an explanation of whether untrusted input can reach it and whether another layer already enforces parameterization.
- Include the repository revision so file references remain meaningful.
- Explain severity using impact and preconditions.
- Redact secret values from reports and transcripts.
- Mark findings that need additional runtime or deployment evidence.
Verify fixes without overstating coverage
Review the proposed diff, add a focused regression test where practical, and rerun the relevant checks. A passing test suite is useful evidence, but it does not turn a bounded review into a complete security certification.
The final report should say what changed, which commands actually ran, what their results were, and what remains unresolved. Keep deployment and production changes outside the audit unless they have been separately authorized.