“What is our AI risk?” is now a standing board question, and it is usually asked as if AI were one thing. It is at least three: code written by AI assistants, products that embed language models, and agents that use tools with real permissions. They have different failure modes, different owners and different controls. Treating them as one topic is why so many AI security policies are either too vague to apply or too strict to follow.

In short

  • Surface 1, AI-written code, is mostly a volume and review problem. Existing AppSec controls apply; they need to keep up.
  • Surface 2, AI-powered features, adds new vulnerability classes: prompt injection, unsafe output handling, model supply chain, data leakage.
  • Surface 3, AI agents, is an identity and authorisation problem. An agent with a shell tool is a privileged user that takes instructions from text.
  • Start with an inventory. You cannot govern models, agents and MCP servers you do not know exist, and questionnaires go stale in weeks.

Three surfaces, side by side

1 · AI-written code2 · AI-powered features3 · AI agents
What it isCode suggested or generated by assistants, merged by developersLLM calls inside your product: chat, summarisation, RAGModels that choose and call tools: shell, APIs, files, email
Main risksMore code, faster; plausible but insecure patterns; invented or outdated dependenciesPrompt injection, output reaching eval or SQL, poisoned or unsafe model files, leaking secrets or dataExcessive agency, privilege misuse, unbounded loops, actions triggered by untrusted content
Natural ownerEngineering and AppSecProduct engineering and AppSecPlatform, identity and security architecture
Control that matters mostThe same scanning and review gates, applied consistentlySecure design patterns and testing against the OWASP LLM Top 10Inventory, least privilege and a policy decision before each tool call
flowchart LR D["Developer +
assistant"] -->|"surface 1"| R["Repository"] R --> P["Product with
LLM feature"] U["User or
external content"] -->|"surface 2"| P P --> A["Agent"] A -->|"surface 3"| T["Tools
shell, APIs, data"] style A fill:#fef3c7,stroke:#b45309 style T fill:#fee2e2,stroke:#be123c

The further right, the more an AI failure becomes an action rather than a bug.

Surface 1: code written with AI

Developer adoption is no longer a question. Stack Overflow’s 2024 developer survey found roughly three-quarters of respondents were using or planning to use AI tools in their development process. The security effect is not that AI code is uniquely dangerous; academic studies have found both better and worse outcomes depending on the task. The effect is volume. More code and more dependencies arrive per developer per week, and review capacity does not grow with them.

Industry
data

About three-quarters of developers responding to Stack Overflow’s 2024 survey said they use or plan to use AI tools in development. Security researchers have also documented assistants suggesting package names that do not exist, which attackers can then register — a risk sometimes called “slopsquatting”.

Sources: Stack Overflow Developer Survey 2024; academic and industry research on package hallucination (2024–2025).

The controls are the familiar ones — static analysis, dependency scanning, secrets detection, a CI gate — but they have to be automatic and quiet enough that developers do not route around them. If AI doubles the rate of change, a noisy gate doubles the friction.

Surface 2: AI inside your product

Once a product calls a model, new classes of vulnerability appear. OWASP’s Top 10 for Large Language Model Applications, revised for 2025, is the most widely used catalogue. Several of its entries can be found directly in code before anything runs.

OWASP LLM 2025What it looks like in codeBusiness impact
LLM01 Prompt injectionUser input formatted straight into a promptThe model follows an attacker’s instructions instead of yours
LLM02 Sensitive information disclosureA provider key shipped to the browser; secrets in configsCost abuse, data leakage
LLM03 Supply chainPickle model files that can execute code on load; trust_remote_code=TrueCode execution from a downloaded model
LLM05 Improper output handlingA model’s answer passed to eval, a shell or SQLClassic injection, with the model as the attacker’s proxy
LLM07 System prompt leakageCredentials written into a system promptAnyone who extracts the prompt gets the key

The model supply chain deserves particular attention. Several common model formats, including Python pickle, can run arbitrary code when loaded, and security researchers have repeatedly found malicious model files on public model hubs. A data science team downloading a model is, in effect, running code from the internet.

An AI finding in InsightFortify mapped to an OWASP LLM category with the evidence and remediation
An AI finding. Mapped to the OWASP LLM Top 10, with the code location and the fix, in the same queue as every other finding.

Surface 3: agents that act

An agent is a model in a loop that chooses tools: run a command, call an API, read a file, send a message. Protocols such as the Model Context Protocol, introduced in late 2024, have made it easy to give an agent dozens of tools at once. The security question changes from “what might the model say?” to “what might it do, with whose credentials, because of whose text?”

sequenceDiagram participant U as Customer email participant A as Support agent participant G as Policy check participant T as Shell tool U->>A: Ticket text with a hidden instruction A->>A: Model decides to run a command A->>G: May I call shell.run on this target G-->>A: Deny - shell is not allowed for this agent A->>U: Replies without running anything Note over G: The denied attempt is recorded
and raised as a finding

Illustrative: prompt injection reaching an agent with tools, stopped by a policy decision before the call.

The useful framing for executives is identity, not intelligence. An agent is a non-human identity with a set of permissions that takes instructions from content it reads. The same principles apply as for any privileged service account: know it exists, give it the least privilege it needs, require approval for consequential actions, log what it does, and cap how much it can do per hour.

Start with an inventory

Every one of these controls depends on knowing what AI exists. Surveys of engineering teams go stale quickly; an inventory derived from code updates on every push. InsightFortify’s AI analyser reads each repository for model weight files, models named in code, LangChain, CrewAI and AutoGen agents with their tools, and MCP servers in client configurations. It reads model files without loading them and code without running it.

The AI inventory: models, agents and MCP servers discovered across repositories
The AI bill of materials. Models, agents and MCP servers, by repository, with what each can reach.

Not every agent needs the same controls

The fastest way to stall AI adoption is to apply the strictest controls to every agent. The fastest way to an incident is to apply none. Tiering agents by the consequence of their actions lets most of them ship quickly while the few that matter get real scrutiny.

TierExampleWhat it can doMinimum controls
1 · Read-onlyInternal documentation assistantSearch and summarise approved sourcesInventory, logging, no credentials in prompts
2 · Internal writeEngineering agent that opens tickets or drafts codeCreate or change internal recordsTier 1 plus least-privilege tools, rate limits, human review of changes
3 · External actionSupport agent that issues refunds or emails customersAct on customers, money or external systemsTier 2 plus approval for consequential tools, deny lists for hosts, per-call policy decision
4 · PrivilegedOperations agent with shell or cloud admin toolsChange infrastructureTier 3 plus sandboxing, no internet-facing input, named human owner, frequent review

InsightFortify’s guardrail policies map directly onto these tiers: deny_tool, require_approval, deny_host and max_calls_per_hour, each bound to the agents it governs. The same policies are checked against the inventory, so an agent that merely holds a denied tool is a finding before it ever uses it.

Questions boards ask about AI, and answers that hold up

The questionA weak answerA strong answer
Where are we using AI?“We surveyed the teams.”“Our scans find 14 models, 6 agents and 9 MCP servers across 120 repositories; here is the list, updated on every push.”
Could an AI system leak customer data?“We have a policy against it.”“Two features had prompt-injection paths; both are fixed. No agent with access to customer data can call external hosts.”
What can our agents do without a human?“Only what they are designed to.”“Refunds and outbound email require approval; shell tools are denied for anything customer-facing. Last quarter 37 calls were blocked.”
Are we exposed through AI suppliers?“We use reputable vendors.”“All model files are safetensors from pinned sources; remote code execution on load is disabled everywhere.”

The numbers in the strong answers are illustrative. What makes them strong is that each one comes from an inventory or a log, not a survey, and so it can be checked and repeated next quarter.

A control set for each surface

COMMON TODAY One AI policy for everything

A single document covering assistants, chatbots and agents. Too strict for developers using autocomplete, too vague to stop an agent with a shell tool.

BETTER Controls matched to the surface

Scanning and gates for AI-written code; OWASP LLM testing for AI features; inventory, least privilege and per-call policy for agents.

A first-quarter plan for AI securityIllustrative sequence; adapt to your estate
1
Inventory models, agents and MCP serversAppSec

Scan every repository, including the ones nobody thinks use AI.

2
Fix the model supply chaindata science + AppSec

Prefer safetensors over pickle; pin and review model sources; remove trust_remote_code.

3
Map AI features to the OWASP LLM Top 10product engineering

Treat findings like any other: priority, owner, SLA.

4
Classify agents by consequencesecurity architecture

Read-only, internal-write and external-action agents get different policies.

5
Put a policy check before tool callsplatform

Deny dangerous tools, require approval for consequential ones, cap the call rate.

6
Report the inventory to the boardCISO

Number of agents, what they can do, and what was blocked.

For the CISO

Separate the three surfaces in policy and in reporting. Each has a different owner.

Agents are the newest and least governed. Treat them as privileged identities from day one.

For the AppSec lead

Most AI-feature risks are findable in code. Add them to the same queue and the same SLA.

The model file format is a supply-chain control, not a data-science preference.

For the board

Ask for an inventory, not an assurance: how many models, agents and tool connections exist, and what each can do.

Ask what the organisation’s agents were prevented from doing last quarter.

AI is three attack surfaces: the code it writes, the features it powers and the actions it takes.

Govern each one with controls that fit it, and start every conversation from an inventory.

Keep reading