AI-Assisted Secure Coding (Appendix C) · Validation of AI-Generated Code
A human reviews all AI-generated code
Verify that AI-generated code always goes through code review by a qualified human engineer. The reviewer must not be the same identity that asked for the AI generation in the first place (separation of duties). And the AI agent itself does not count as the human reviewer.
OWASP AISVS v1.01, requirement AC.4.1
In plain English
A qualified engineer must review all AI-generated code. The reviewer has to be someone other than the person who asked the AI to write it, and an AI agent never counts as the human reviewer. This is separation of duties, applied to a new kind of author.
What good looks like
- Branch protection requires at least one human approval on every change.
- The person who prompted the AI cannot approve the resulting change.
- Approvals from bots and AI reviewers do not count towards the required number.
- Reviewers are qualified for the code they approve.
How teams usually do it
- Branch protection or rulesets requiring reviews, with code owners, "require approval from someone other than the last pusher" and stale approvals dismissed on new commits.
- Bot accounts excluded from the reviewers who can satisfy the rule.
- Agents opening pull requests under their own identity, so the human who started the task is recorded as requester.
Suggested evidence
- Branch protection settings.
- A sample of merged AI-generated PRs with their human reviewers.
Common mistakes
- A developer generating code and approving it from a second account.
- An AI reviewer's approval counting as the required review.
- Reviews of very large AI-generated diffs that are approved in two minutes.
Not sure which requirements apply to your system? Take the assessment, or browse every guide in this chapter.
Requirement text from the OWASP AI Security Verification Standard, licensed under CC BY-SA 4.0. This guidance is shared under the same licence.