AI-Assisted Secure Coding (Appendix C) · Adversarial AI Detection in Inbound Contributions
Profile PRs for LLM-generated code
Verify that PR analytics include structural AST profiling and stylometric or entropy-based heuristics tuned to identify LLM-generated code patterns. Detection in this category is still maturing, so compensating controls are accepted in place of high-precision automated detection: mandatory human review on flagged PRs, sandboxed execution of suspect payloads, and deferred merge until additional signals accrue.
OWASP AISVS v1.01, requirement AC.13.6
In plain English
Profile pull requests for the patterns typical of LLM-generated code, using code-structure analysis and style or entropy heuristics. The standard accepts that this kind of detection is still immature. Compensating controls are allowed in place of precise detection: mandatory human review of flagged PRs, running suspect code only in a sandbox, and delaying the merge until more signals arrive. This is a Level 3 control.
What good looks like
- Some form of structural or stylometric profiling runs on PRs.
- Flagged PRs get mandatory human review.
- Suspect payloads are executed only in a sandbox.
- Merges of flagged PRs wait until more evidence is available.
How teams usually do it
- Heuristics over the syntax tree and style of the diff, combined with contributor signals (AC.13.1).
- Review and sandbox rules keyed on the flag.
- Treating the score as one signal among several, and recording how often it turns out to be right.
Suggested evidence
- Profiling configuration.
- Flagged examples and what happened to them.
- Measured precision of the heuristics.
Common mistakes
- Treating a detection score as proof of intent. Plenty of legitimate contributors use AI.
- Rejecting PRs on the score alone.
- Buying a detector and never measuring its false-positive rate.
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.