Teams should govern the specification first, then the code. The PRD should define architecture, constraints, tests, and acceptance criteria before generation begins, because that is where ambiguity is controlled. Once work starts, the document must stay current so reviewers can validate decisions, not just inspect output after the fact.
Why This Matters for Security Teams
When an AI model writes most of the implementation, the risk shifts from typing code to governing intent, constraints, and verification. That changes how security, engineering, and product teams should review work. The real question is no longer whether the code “looks right,” but whether the specification captured the right architecture, trust boundaries, data handling rules, and test expectations before generation began. NIST’s NIST Cybersecurity Framework 2.0 is useful here because it reinforces governance, risk management, and control ownership as continuous responsibilities, not a one-time sign-off.
AI-assisted coding can accelerate delivery, but it also makes undocumented assumptions harder to spot. A model may produce secure-looking code that still violates internal policy, weakens logging, mishandles secrets, or introduces dependency risk. Security teams often miss this when they focus only on the final pull request and not on the upstream specification that shaped the output. The most common failure is treating AI output as if it were conventional developer-authored code, when in practice the review burden is broader and more structured.
In practice, many security teams encounter the weakest control point only after the code has already been merged, rather than through intentional specification review.
How It Works in Practice
Governance should start with a written specification that defines what the system is allowed to do, what data it may touch, what external services it may call, and what security tests must pass. That specification becomes the review artifact for both humans and AI-assisted workflows. If the model generates an implementation, reviewers should verify alignment against the approved design rather than infer intent from the code itself. This is especially important for authentication logic, authorization checks, secrets handling, logging, and any code that changes trust boundaries.
Practically, teams should treat AI-assisted development as a controlled pipeline:
- Define architecture, threat assumptions, and prohibited patterns before generation begins.
- Require explicit acceptance criteria, including security tests and failure cases.
- Track which sections of code were AI-assisted so reviewers know where to focus.
- Validate outputs against policy, not just style or compilation success.
- Preserve traceability from requirement to implementation to test evidence.
Security control mapping can help keep this disciplined. NIST SP 800-53 Rev. 5 Security and Privacy Controls provides useful anchors for access control, configuration management, auditability, and system integrity. Those controls are easier to apply when the PRD explicitly names the required behaviour, the expected guardrails, and the evidence needed for approval. Current guidance suggests that AI-generated code should be reviewed as part of a secure software development lifecycle, not as a separate exception process.
This guidance breaks down when teams let copilots or agents operate across multiple repositories without maintaining a current specification, because reviewers lose a reliable source of truth for intended behaviour.
Common Variations and Edge Cases
Tighter governance often increases delivery overhead, requiring organisations to balance speed against confidence. That tradeoff is real, especially when teams use AI for prototyping, refactoring, or test generation. Best practice is evolving, but the operational principle remains stable: the more autonomy the model has, the more precise the controls around scope, review, and verification must be.
There are a few common edge cases. For low-risk internal tooling, teams may accept lighter documentation if the blast radius is limited and the code is non-sensitive. For regulated environments, such as financial services or healthcare, the specification usually needs stronger traceability, approval evidence, and segregation of duties. For agentic workflows, governance should also cover tool permissions, because the AI system may not just write code but also run commands, open pull requests, or modify infrastructure.
This is where identity and privilege matter. If an AI coding agent has broad repository, CI/CD, or cloud access, the control problem becomes an NHI governance issue as much as a software engineering issue. Teams should clearly define what the agent can do, what it cannot do, and how its actions are logged and reviewed. There is no universal standard for this yet, but the safest pattern is least privilege, narrow task scope, and continuous human accountability.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
NIST CSF 2.0, NIST SP 800-53 Rev 5 and NIST AI RMF set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST CSF 2.0 | GV.OV-01 | Governance and oversight fit AI coding review and accountability. |
| NIST SP 800-53 Rev 5 | CM-2 | Baseline configuration control supports approved implementation constraints. |
| NIST AI RMF | GOVERN | AI governance covers accountability, policies, and documented intended use. |
Lock approved build and code settings before generation and review changes against them.