MSBA-312 · Lesson 6 of 12 · 19 min
Security reviews and threat modeling
▶ Video coming soon A video version of this lesson is on the way.
Every new Quillfield AI solution passes three reviews before production: the responsible AI review from Lesson 5, a compliance review covered in Lesson 7, and a security review. Bram wrote the security review's procedure in October 2026 with Quillfield's IT security lead and Wendell, after a short and uncomfortable conversation about the Northmark Mutual MCP server. The Policy Service Assistant had been calling Northmark's appetite tools since MSBA-241, and when Wendell asked who had reviewed what those tools could return, and what the agent would do with it, the honest answer was that the connection had been reviewed for authentication but not for what an untrusted response could make the agent do.
This lesson covers the security side of the AB-100 deploy domain: designing security for agents, designing model security, analyzing solution and AI vulnerabilities and mitigations including prompt manipulation, and designing access controls on grounding data and model tuning. It treats security entirely from the defender's side: how to find weaknesses in your own designs and close them.
Why agents change the threat picture
A chatbot that only answers questions can embarrass you. An agent that calls tools can act: change records, send messages, start workflows, read data on behalf of a user. Three properties make agents harder to secure than ordinary applications. Their control flow is decided at run time by a model reading natural language, so the line between data and instructions is blurred. They often hold delegated authority, either the user's or their own identity's, so a manipulated agent acts with real permissions. And they increasingly connect to other agents and external tools through protocols such as the Model Context Protocol, which extends the supply chain to parties you do not control.
The OWASP GenAI Security Project's lists help structure thinking. The OWASP Top 10 for LLM Applications (2025 edition) names risks such as prompt injection, sensitive information disclosure, supply chain weaknesses, improper output handling, excessive agency, system prompt leakage and unbounded consumption. The OWASP Top 10 for Agentic Applications, released in December 2025, adds risks specific to agents, from agent goal hijack and tool misuse to identity and privilege abuse, insecure inter-agent communication, cascading failures and rogue agents. Neither list is a checklist to tick; both are prompts for the question "could this happen here, and what stops it?"
Threat modeling an agentic solution
Threat modeling is the structured practice of identifying what could go wrong in a system's design before it is built or changed. Microsoft's long-standing approach uses a data flow diagram that shows processes, data stores, external entities and the flows between them, with trust boundaries marking where data crosses from one level of trust to another. Threats are then identified at each element and boundary, often with the STRIDE categories: spoofing, tampering, repudiation, information disclosure, denial of service and elevation of privilege. Microsoft's free Threat Modeling Tool supports this, but a whiteboard works as well.
For agentic solutions, Bram adds three element types to the diagram: the model (a process whose behavior depends on everything in its context), context sources (instructions, knowledge, tool outputs, memory and messages from other agents, each a possible carrier of instructions) and tools (each a capability with a blast radius). The key trust boundary is the one most diagrams miss: between content the agent *reads* and instructions the agent *follows*. Any text that crosses into the model's context from an untrusted source, such as a client email, a carrier's MCP response or a web page, must be treated as potentially hostile.
| Threat | Example | Mitigation in Quillfield's design |
|---|---|---|
| Spoofing | A look-alike server impersonates Northmark | Fixed server URL, OAuth with Northmark's identity provider, connection reviewed in the tools registry |
| Tampering | A response contains planted instructions to the agent | Treat tool output as data; instructions forbid following text in tool results; output length limits |
| Repudiation | No record of which appetite answer the agent relied on | Tool calls and responses traced in Application Insights; transcripts retained per policy |
| Information disclosure | Agent sends client details to Northmark in a query | Tool inputs limited to class of business and province or state; no client names in the schema |
| Denial of service | Northmark server slow or down | Timeouts, fallback message, monitoring alert |
| Elevation of privilege | Agent uses an appetite answer to justify a policy change | Appetite tools are read-only; change requests always need underwriter approval |
Designing security for agents
The study guide's "design security for agents" covers four main areas. The first is identity. Each agent should run under an identity that is clearly its own when it acts autonomously, and under the user's identity when it acts for a user. Microsoft Entra Agent ID gives agents identities that can be governed like other identities, with owners or sponsors, access packages, conditional access and lifecycle workflows, as MSBA-205 described. Quillfield's rule, set by Wendell in MSBA-241, is that read tools use end-user credentials, and maker or service credentials need written justification and a narrowly scoped service identity.
The second is least privilege for tools. Each tool should do one thing with the smallest permissions that work. The BrokerDesk custom connector exposes only three operations, not the API's full surface. Agent flows that write to systems run under dedicated connections with narrow rights. When an agent needs a powerful action, design it as a request that a person approves rather than as a direct action.
The third is channel and access control: who can reach the agent, through which channels, and with what authentication. Data policies in the Power Platform admin center can block unauthenticated chat, restrict channels and govern connectors, and Managed Environments can limit sharing. The fourth is runtime protection: prompt filtering and monitoring that detect manipulation attempts while the agent runs, together with the ability to block an agent quickly, which Lesson 9 covers.
Prompt manipulation and its mitigations
Prompt injection is the defining vulnerability of language-model systems. In direct injection, a user types instructions intended to override the agent's rules. In indirect injection, also called cross-prompt injection, the instructions arrive inside content the agent processes, such as an email, a document, a web page or a tool response. Because language models do not reliably separate instructions from data, no single control eliminates injection. Microsoft's own approach for Microsoft 365 Copilot is defense in depth: classifiers that detect jailbreak and injection attempts, content filtering, sanitization of hidden characters, analysis of tool chains, and audit signals such as a flag when a jailbreak attempt is detected, combined with the user's own permissions limiting what any successful attack can reach.
For an architect, the most reliable mitigations are design choices that limit the consequences of a successful injection. Ask of every tool: if the model were fully manipulated, what is the worst this tool could do? Then reduce it. Quillfield's designs use four patterns. Human approval before high-impact actions (underwriter approval on change requests, broker review of certificates). Constrained tools that cannot reach outside, such as the certificates agent's ability to create drafts but not send them. Separated duties so that an agent reading untrusted content does not also hold powerful tools; in the Commercial Submission Desk design, the agent that reads client documents passes structured findings to a workflow rather than calling carriers itself. And detection through Azure AI Content Safety's prompt shields for Foundry components, Copilot Studio's built-in protections, and monitoring for unusual tool use.
Worked problem
Reviewing the certificates-mailbox agent for indirect injection
The certificates agent reads about 60 emails each working day from clients and their contractors, and drafts certificates in BrokerDesk for broker review. An email could contain hidden instructions. What does the security review check?
Show solution
- Map the trust boundary: email bodies and attachments are untrusted content entering the model's context.
- List the agent's tools and their worst case: read policy details for the named insured, create a draft certificate; no send, no delete, no change to policies.
- Check identity: the agent runs as a dedicated identity with read access to the certificates mailbox and draft-only rights in BrokerDesk.
- Check detection: injection attempts are logged, and a weekly report lists emails where the agent declined instructions.
- Check the human step: brokers review every draft, and the draft shows the source email beside the generated wording.
Answer: The design limits a successful injection to a wrong draft that a broker must still approve; the review adds a check that drafts never include wording absent from BrokerDesk endorsements, and confirms logging and the weekly report.
Model security
Models are assets to protect too. The study guide's "design model security" asks architects to control who can use, change and deploy models. In Foundry, that means using Microsoft Entra ID authentication with Azure role-based access control rather than shared API keys wherever possible, so that every call is attributable and access can be revoked per identity; restricting network access to Foundry resources with private endpoints where the architecture allows; limiting who can create or change model deployments in production; and applying content filters to deployments so that harmful inputs and outputs are blocked at the platform level. Upgrade policies on model deployments (Lesson 8) are also a security setting, because an unplanned model change is an unreviewed change.
For custom or fine-tuned models, the training pipeline is part of the attack surface. Tampered training data can change a model's behavior in ways that are hard to detect afterwards, which is why model lineage (Lesson 2) and access control on training data matter.
Access control on grounding data and tuning data
An agent can only leak what it can reach. Grounding data (the knowledge sources and tools an agent uses to answer) should be scoped so that the agent retrieves only what the user is entitled to see. For Microsoft 365 knowledge such as SharePoint, retrieval respects the user's permissions when the agent uses the user's identity, which makes the permissions in those libraries part of the agent's security. Oversharing in SharePoint, a common problem for Copilot rollouts, becomes an agent problem too. For Dataverse knowledge, security roles and column-level security limit what is returned. For Foundry agents using Azure AI Search or Foundry IQ knowledge bases, document-level security must be designed explicitly, for example by storing access groups with each document and filtering at query time.
Tuning data (data used to fine-tune or train models) needs stricter control still, because once information is learned by a model it cannot be selectively removed or permission-trimmed. The rule in Quillfield's operating model is that no personal information goes into tuning data without a privacy review, that tuning datasets live in a restricted store with access logged, and that only Ngozika's team can start training jobs.
The review procedure
Quillfield's security review is a meeting, a document and a decision. The architect brings the data flow diagram, the tool inventory with each tool's identity and worst case, the identity and access design, and the results of red teaming. The security lead and Wendell walk through STRIDE at each trust boundary and the relevant OWASP agentic risks. Findings are rated, and high findings must be fixed before production. The review is repeated when an agent gains a tool, a channel, an external connection or a new identity. The Northmark connection was reviewed again on November 9, 2026 under the new procedure; it led to the input-schema restriction and the output-handling instruction in the STRIDE table above.
Security in the release process
A review done once at launch protects only the launch version. Quillfield's release classes from Lesson 8 tell the security lead which changes need another look: any major release, any minor release that adds a tool or connection, and any change to identities, authentication or channels. For those, the architect updates the data flow diagram and tool inventory in the same pull request as the change, so that the reviewer sees the design change and the code change together. The security lead's approval is a required step in the pipeline for those classes, and the zero-tolerance evaluation cases from red teaming run on every release regardless of class.
Common mistakes
MistakeReviewing an external tool connection only for authentication.
InsteadReview what the tool can return, how the agent treats it and what a manipulated agent could do with it.
MistakeRelying on instructions alone to stop prompt injection.
InsteadLimit consequences with approvals, constrained tools and separated duties, and add detection.
MistakeUsing shared API keys for model access in production.
InsteadUse Microsoft Entra ID authentication and role-based access so calls are attributable and revocable.
MistakeAssuming the agent's knowledge is safe because the library is internal.
InsteadCheck permissions on grounding data; an agent exposes whatever its identity or user can reach.
MistakePutting personal information in tuning data without review.
InsteadRestrict tuning data, require privacy review and log access.
Summary and key terms
- Agents act with delegated authority, decide control flow at run time and extend the supply chain, which changes the threat picture.
- The OWASP Top 10 for LLM Applications and the OWASP Top 10 for Agentic Applications structure the risks to consider.
- Threat modeling with data flow diagrams, trust boundaries and STRIDE works for agents when model, context sources and tools are drawn explicitly.
- Agent security design covers identity, least-privilege tools, channel and access control, and runtime protection.
- Prompt injection cannot be fully prevented, so designs limit consequences and add detection.
- Model security, grounding data access and tuning data controls complete the review, which repeats on significant change.
- Threat modeling
- A structured method for identifying and mitigating what could go wrong in a system's design.
- Trust boundary
- A line in a data flow diagram where data passes between levels of trust.
- STRIDE
- Threat categories: spoofing, tampering, repudiation, information disclosure, denial of service, elevation of privilege.
- Prompt injection
- Manipulating a language model through instructions supplied directly by a user or hidden in content it processes.
- Excessive agency
- Giving an AI system more functionality, permissions or autonomy than its task requires.
- Grounding data
- The knowledge and tool results an agent uses to form its answers.
Practice problems
Work each problem on paper first, then reveal the answer to check.
What trust boundary do most agent diagrams miss?
Show answer
The boundary between untrusted content the agent reads and the instructions it follows.
Give two design patterns that limit the damage of a successful prompt injection.
Show answer
Human approval before high-impact actions, tools constrained to safe operations, or separation between reading untrusted content and holding powerful tools.
Why is tuning data controlled more tightly than grounding data?
Show answer
Information learned by a model cannot be selectively removed or permission-trimmed later.
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.