AI coding assistants and coding agents now write, refactor and commit code faster than existing review and testing processes were designed to handle, and agents act on developer machines and pipelines with real credentials. Two kinds of product have grown up in response: tools that check the code AI produces, and tools that govern what coding agents are allowed to do. Both are sold under labels such as AI code security, AI code security assistants and agentic coding security. This vendor-neutral buyer's guide explains what the category covers, when you need it, the capabilities that matter and how to run a proof of concept. Classic SAST, DAST and SCA selection is covered in the Application Security Testing Buyer's Guide; this page focuses on what changes when AI writes the code and agents run the tools. It is for AppSec leads, platform engineering and security architects.
Key takeaways
- Two problems, two control sets. Securing AI-generated code is an extension of AppSec testing. Securing coding agents is an identity, permission and sandboxing problem. Many products cover only one; know which you are buying.
- Agent credentials are the largest blast radius. An agent that can read a long-lived cloud or platform token in the repository can do anything that token allows. Evaluate how a product limits and observes agent actions, not just how it scores code.
- Dependency suggestions need verification. OWASP and OpenSSF both describe assistants suggesting packages that do not exist, which attackers can register. Package existence, age and reputation checks belong at the point of suggestion.
- Measure fix quality, not finding counts. AI remediation that opens pull requests is useful only if fixes compile, pass tests and do not introduce new issues. Score this on your own repositories.
- Keep humans and SSDF controls in the loop. NIST SSDF practices PW.7 and PW.8 (review and test) still apply to AI-written code; the product should feed those steps, not replace them.
What the category does
The market splits into the capability groups below. Products often combine two or three, and many existing application security tools have added AI features.
| Capability group | What it does | Where it runs | Main risk addressed |
|---|---|---|---|
| In-IDE scanning of AI suggestions | Scans generated code for vulnerabilities, secrets and insecure patterns as it is written | IDE plugin, language server, assistant integration | Insecure code generation (OWASP LLM09 unsafe code generation) |
| AI-assisted code review | Reviews pull requests with a model, explains risk and suggests fixes | Source control integration, CI | Volume of AI-written changes exceeding human review capacity |
| AI remediation (auto-fix) | Generates patches for findings from SAST, SCA or secret scanners and opens pull requests | CI, AppSec platform | Fix backlog; mean time to remediate |
| Dependency and package guard | Checks suggested or installed packages for existence, age, typosquatting, malware and licence | IDE, package proxy, CI | Package hallucination and slopsquatting |
| Coding agent governance | Controls which tools, commands, files, MCP servers and network destinations an agent may use; requires approval for risky actions | Agent configuration, endpoint, sandbox, proxy | Excessive agency (LLM06), prompt injection via repository content (LLM01) |
| Agent activity monitoring | Records prompts, commands, file changes and credential use by agents; attributes changes to humans and agents | Endpoint, CI, source control audit logs | Investigation and accountability |
| Assistant configuration posture | Inventories assistants, extensions, instruction files and MCP connections in use; flags risky settings | Endpoint, source control, admin APIs | Shadow assistants, malicious rules files and extensions |
For background on the attack surface see the AI Coding Agents Security Guide and the Coding Agent Configuration File Attacks.
When you need it
| Your situation | Priority capability | Can existing tools cover it? |
|---|---|---|
| Developers use chat assistants and inline completion only | In-IDE scanning, secret detection, package guard | Often yes, if your SAST and SCA have IDE plugins and run on every pull request |
| AI writes a large share of merged code and reviewers are overwhelmed | AI-assisted review and auto-fix with test gating | Partly; check whether current tools can triage and fix at that volume |
| Agents run commands in terminals, edit many files and open pull requests | Agent governance, sandboxing, activity monitoring | Rarely; traditional AppSec tools do not see agent actions |
| Agents run unattended in CI or cloud environments | Agent identity, scoped short-lived credentials, network egress control, audit | Partly, through workload identity and pipeline controls |
| Non-developers build applications with AI (vibe coding) | Guardrails in the platform, secret detection, deployment gates | Usually not; see the Vibe Coding Security Guide |
Small teams: enable the security features already in your source control platform and assistant, add a package guard and a pre-commit secret scanner, and set agent permissions to approval mode. A dedicated product is justified once agents run unattended or several assistants are in use. Large organisations: the deciding needs are usually central policy across many assistants and agents, attribution of changes to agents, and evidence for audit.
Must-have capabilities
For AI-generated code
- Analysis at the point of generation and at merge: early feedback in the IDE and an authoritative gate in CI, with the same rule set, so results do not conflict.
- Secret detection in suggestions and commits: the OpenSSF guide recommends instructing assistants never to place keys or passwords in code and checking suggestions for secrets. A product should catch what slips through and route it to rotation, not only flag it. See the Developer Secret Scanning Triage.
- Package verification: blocks or warns on packages that do not exist, were published very recently, have few downloads, resemble popular names or contain known malware. See the Slopsquatting and Package Hallucination Guide.
- Fix generation with evidence: proposed fixes include the original finding, the change, and test and rescan results before a human sees them.
- Provenance of AI changes: marks or records which commits and pull requests were produced or largely produced by an assistant or agent, so you can apply stricter review rules.
For coding agents
- Command and tool policy: allow and deny lists that parse full commands, not string prefixes. The Gemini CLI prompt injection flaw showed how a prefix-based allow-list let a chained command run without approval after a poisoned README was read.
- Credential isolation: agents get scoped, short-lived credentials for the task, cannot read developer secrets on disk or in environment variables by default, and cannot reach production. In the PocketOS database deletion, an agent used an account-scoped platform token found in an unrelated file to delete a production database and its backups.
- Sandboxing and egress control: container or virtual machine isolation for agent execution, with outbound network restricted to package registries and approved hosts.
- MCP and extension governance: inventory and allow-list of MCP servers, extensions and plugins, with their own credentials visible. See the MCP Gateway and MCP Server Governance Guide.
- Instruction and rules file integrity: detection of hidden or unusual content in agent instruction files and changes to them in pull requests.
- Human approval for destructive or external actions: deletes, force pushes, deployment, infrastructure changes and messages to external parties.
- Full audit trail: prompts, tool calls, commands, files touched and credentials used, attributed to the human who started the session.
Evaluation criteria
| Criterion | What to look for | How to test |
|---|---|---|
| Detection accuracy on AI-written code | True and false positive rates on your languages and frameworks | Seed known vulnerable patterns into AI-generated branches of your own repositories |
| Fix acceptance rate | Share of generated fixes merged without change after review | Run auto-fix on 30 to 50 real findings and have reviewers score each |
| Fix safety | Fixes pass existing tests and rescans, and do not weaken checks | Track build failures and new findings introduced by fixes |
| Assistant and agent coverage | Works with the assistants, IDEs, agent tools and CI systems you use | List every assistant in use and confirm each integration live |
| Policy enforcement point | Where agent policy is enforced: agent configuration, endpoint, sandbox or network | Attempt to bypass by running the agent outside the managed configuration |
| Developer experience | Low latency in the IDE; clear messages; few duplicate alerts | Two-week developer pilot with a short survey |
| Code and data handling | Where source code and prompts are sent, retained and whether used for training | Contract and data processing terms review |
| Standards mapping | Findings and controls mapped to NIST SSDF (SP 800-218 and 800-218A) tasks and OWASP | Ask for an evidence export for one release |
Questions to ask vendors
- Which of these do you cover: AI-generated code analysis, auto-fix, package verification, agent governance, agent monitoring? Which are roadmap only?
- How do you parse agent commands for policy decisions? Show a chained or obfuscated command being blocked.
- How do you stop an agent reading secrets from the developer's environment, dotfiles and repository?
- What signals decide that a suggested package is suspicious, and how fast is your package intelligence updated?
- What is your fix acceptance rate on customers' code, how is it measured, and can we reproduce it on ours?
- How do you attribute a commit or pull request to an agent session and the human who started it?
- Which MCP servers and extensions can you discover, and can you block unapproved ones?
- Does our source code leave our environment? If so, where is it processed and retained?
- What credentials does your own product hold to our source control, CI and cloud, and how are they scoped and rotated?
Deployment and integration
- Inventory assistants and agents: which tools are in use, in which IDEs, with which extensions, MCP servers and credentials. Unknown usage is the first finding.
- Fix the credentials first: remove long-lived tokens from repositories and developer machines, move agents to scoped short-lived credentials and keep production credentials out of development environments. This step reduces risk before any product is deployed.
- Deploy code-side controls in report mode: IDE scanning, package guard and pull request review, comparing results with your current SAST and SCA to remove duplication.
- Pilot agent governance with one team: start with approval mode for all commands, then build allow lists from observed safe commands. Enable sandboxing and egress control.
- Turn on gating: block merges with high-severity findings or unverified new dependencies; require extra review for agent-authored pull requests that touch authentication, payment or infrastructure code.
- Connect audit to the SOC: send agent activity and policy decisions to the SIEM with user and session identifiers.
- Plan rollback: keep the ability to disable a gate per repository with a logged, time-limited exception, so a false positive does not stop delivery.
Metrics: share of active assistants and agents under managed policy; mean time to remediate AI-introduced findings; auto-fix acceptance rate; number of blocked hallucinated or suspicious packages; number of long-lived credentials reachable by agents (target zero); and agent actions requiring approval that were denied.
Framework mapping
| Control objective | NIST SSDF (SP 800-218) | NIST SP 800-53 Rev. 5 | Other |
|---|---|---|---|
| Review and analyse AI-written code | PW.7 | SA-11 | OWASP LLM09 (unsafe code generation) |
| Test executable code | PW.8 | SA-11 | NIST CSF 2.0 PR.PS-06 |
| Verify third-party and suggested components | PW.4 | SR-3, SA-15 | OpenSSF AI code assistant guide |
| Protect code from tampering by agents or tools | PS.1 | SI-7 | Branch protection, signed commits |
| Govern the AI toolchain | PO.3 | CM-11 | SP 800-218A GenAI profile |
| Limit agent permissions | No specific task | AC-6 | OWASP LLM06 Excessive Agency |
| Find vulnerabilities continuously | RV.1 | SA-11 | NIST CSF 2.0 ID.RA-01 |
Pitfalls
- Buying code scanning to solve an agent problem: better scanning of output does nothing about an agent deleting infrastructure with a token it found.
- Allow lists built on command prefixes: easily bypassed with chaining and whitespace; insist on full parsing.
- Auto-fix without tests: fixes that compile but break behaviour erode trust and get the tool switched off.
- Duplicate findings: a new AI layer plus existing SAST produces two answers for every issue. Decide which is authoritative.
- Ignoring the product's own access: a review bot with write access to every repository is itself a privileged non-human identity.
Red flags
- Claims that AI-generated code from the product is "secure by default" or needs no human review.
- No data on fix acceptance or false positives, or data you cannot reproduce.
- Agent controls that rely only on the agent's own configuration file, which the agent or a repository can change.
- No answer on where source code is processed or whether it trains models.
- Requires organisation-wide write tokens with no option to scope per repository.
Proof of concept
- Pick three repositories in different languages, one with heavy AI-assisted development.
- Seed test cases: vulnerable AI-style code, a planted secret, a non-existent package name, a recently published lookalike package and a poisoned instruction file.
- Run an agent task in the sandbox that is tempted by a planted token and an instruction to run a chained command. Confirm the product blocks or requires approval, and that the audit log shows it.
- Run auto-fix on real findings and have reviewers score acceptance, safety and effort.
- Measure IDE latency and alert volume with a developer pilot group.
- Review data handling terms and the product's own permissions before final scoring.
Buyer checklist
- Scope defined: AI-generated code, coding agents, or both.
- Inventory of assistants, agents, extensions and MCP servers completed.
- Long-lived credentials removed from repositories and agent reach before deployment.
- Package verification tested with hallucinated and lookalike names.
- Agent command policy tested against chained and obfuscated commands.
- Sandboxing and network egress control demonstrated.
- Auto-fix scored on your code with tests and rescans.
- Agent activity attributed to human sessions and sent to the SIEM.
- Product's own tokens scoped per repository, with rotation.
- Evidence export mapped to SSDF PW.7, PW.8 and PW.4.
Standards and references
- NIST: SP 800-218A Secure Software Development Practices for Generative AI and Dual-Use Foundation Models
- NIST: SP 800-218 Secure Software Development Framework Version 1.1
- OpenSSF: Security-Focused Guide for AI Code Assistant Instructions
- OWASP: LLM09:2025 Misinformation
- OWASP: Top 10 for LLM Applications 2025
- NIST: SP 800-53 Rev. 5
- CISA: Secure by Design
How NHI Mgmt Group can help
We provide independent advisory on AI coding agent security, including agent credential design and proof of concept test plans. Browse vendors in our products directory or contact us.
Related NHI Mgmt Group resources: Application Security Testing Buyer's Guide · AI IDE and Coding Agent Security Guide · Top 10 Vibe Coding Security Risks · AI SAST Guide · ASPM Buyer's Guide