AI assurance / LLM applications / RAG security
LLM and RAG Risk Controls & Evaluation
Assess the complete application, not just its model. Follow who may access source material, whether retrieved evidence supports the answer, and what actions the system is permitted to take.
For security engineering, AI governance, technology risk, model operations and internal audit teams.
Direct answer
LLM and RAG risk covers unauthorized disclosure, unreliable or manipulated sources, unsupported answers, unsafe actions and operational failures. Assess the full application: identity, retrieval, context assembly, model output, connected tools and monitoring.
A large language model (LLM) generates responses using learned patterns and the context it receives. Retrieval-augmented generation (RAG) adds material from documents, search systems or APIs to help answer a question. Lewis and colleagues introduced a foundational RAG approach in 2020. The quality of a live application depends on its own sources, architecture and evaluation.
Check an answer against the passage it cites, the source’s date and the reader’s access rights. A source may be outdated or inaccurate, and a correct answer can still expose information to someone who should not see it.
- Governance and risk
- Define the intended task, affected users, permitted actions, material failure consequences, risk owner and approval authority.
- Engineering and operations
- Record the identity path, source collections, model and retrieval settings, tools, integrations and error-handling behavior.
- Assurance evidence
- Test the controls that prevent unauthorized disclosure, unsupported answers and unsafe actions. Retain results, exceptions, approved limits and review triggers.
For supplier questionnaires, external reports and contractual assurances, use Vendor AI Risk and Vendor AI Risk Evidence.
Architecture and security boundaries
Follow the information from source to answer.
Retrieval can pass through document ingestion, indexes, reranking, caches and tools. Each step can affect the content seen by the model or the user.
Preserve source identity, document versions, effective dates, classification and access permissions when ingesting material. Carry those attributes through parsing, chunking and indexing, and update derived records when a source is removed or permissions change.
Establish identity
Authenticate the caller and resolve trusted user, group and tenant context.
Retrieve permitted content
Enforce document access through retrieval, reranking and final context assembly.
Generate and attribute
Keep source material separate from instructions; track which passages support claims.
Validate and deliver
Recheck output, citations, cache entitlements and tool-action authorization.
Protect diagnostic logs, limit resource use and preserve the records needed to investigate unexpected results.
Three places to test the boundary
Can an unauthorized caller submit a query or manipulate the identity or permission filter?
Can reranking, cached responses, session memory or citation previews return a source the caller cannot access?
Can model output invoke a tool with arguments or permissions that the requesting user lacks?
Enforce authorization in identity, search and data services—not in prompts. Use native document-level controls where suitable. Microsoft’s Azure AI Search security-filter pattern illustrates an alternative: the application must obtain trusted identity and entitlement information and apply the correct filter to every query. A filter string alone does not authenticate a user.
Security and reliability
LLM and RAG risk: control, test, evidence.
Use the matrix to assign control owners, design tests, and identify the evidence needed before approving each relevant capability.
These eight failure classes cover common issues in LLM and RAG applications. One defect may create several risks: a manipulated document can distort an answer and influence a connected tool. The categories draw on OWASP’s LLM security guidance.
On mobile, swipe horizontally to inspect all four columns. Keyboard users can focus the table region and scroll horizontally.
| Failure and consequence | Control to implement | Test to perform | Evidence to retain |
|---|---|---|---|
| Unreliable or poisoned sources Outdated policy or manipulated content drives an answer. |
Approved ingestion; version and provenance records; quarantine and deletion propagation. | Insert a superseded policy, duplicate chunks and a tampered source. Check eligibility and removal from the final context. | Source owner, ingestion rules, corpus snapshot and failed-source disposition. |
| Provider and logging exposure Sensitive inputs reach an unapproved service or diagnostic store. |
Approved data paths; minimization and redaction; verified provider processing, retention and training-use terms/settings. | Trace normal, retry and error paths with synthetic sensitive markers. Check destinations, telemetry redaction and log access. | Permitted data categories, provider terms/settings snapshot, outbound-path checks and log retention/access rules. |
| Permission leakage Another role or tenant’s material reaches context, output or citations. |
Permission-aware retrieval and context assembly; entitlement-aware cache isolation and invalidation. | Use paired identities, cross-tenant queries and warm-cache requests; revoke access and test again. | Identity-policy reference, expected allow/deny cases, stage-level source IDs and leak findings. |
| Prompt injection User or source content attempts to redirect behavior or obtain secrets. |
Separate instructions and source data; constrain capabilities and egress; validate outputs and tool requests. | Challenge user inputs and retrieved material with malicious instructions. Test answer manipulation and unauthorized actions under repeated runs. | Payload version, attack objective, achieved behavior, control settings and retest result. |
| Missing or misleading context Relevant evidence is absent, truncated or displaced. |
Measure retrieval and final-context coverage; govern chunking, ranking, token budgets and freshness. | Test distractors, conflicting sources, long contexts and evidence placed at different positions. | Query labels, retrieved ranking, final context, relevant source versions and configuration. |
| Unsupported answer or citation A material claim is wrong, ungrounded or linked to irrelevant evidence. |
Claim-level evaluation; verified source references; defined abstention and escalation behavior. | Include answerable and unanswerable questions. Inspect material claims against authoritative references and cited passages. | Rubric, expert judgments, disagreements, unsupported claims and escalation outcomes. |
| Unsafe output or excessive agency Generated content executes or an action exceeds authority. |
Context-appropriate output encoding, schema validation, least-privilege tools and approval for consequential actions. | Challenge HTML rendering, structured fields and tool parameters. Verify denials and approval gates at execution. | Validation rules, tool scopes, authorization decisions and approval/action records. |
| Resource exhaustion or change failure Requests consume excessive cost or a new configuration silently regresses. |
Token, time, concurrency and spend limits; bounded retries; monitored release and tested rollback. | Exercise oversized input, repeated calls, retrieval outages and rollback to a known configuration. | Load profile, latency/cost/error results, alert delivery and recovery exercise. |
For each test, record the version, source collection, identities and conditions used. Investigate unauthorized disclosures or actions as individual findings instead of burying them in an average quality score.
Evaluation and measurements
Measure retrieval, answers, and security separately.
Before testing, define the test set, scoring rules, pass criteria and the decision each result will inform.
Build a versioned test set covering ordinary tasks and difficult conditions: stale or conflicting documents, unsupported questions, denied access, prompt injection, long context and service outages. Keep a separate acceptance set that was not used to tune the application, and record possible test contamination.
Retrieval quality
Does the right evidence reach the model?
For questions with sufficiently complete relevance judgments, Recall@k equals the number of relevant eligible items in the top k divided by the total relevant eligible items. State whether items are documents or chunks; define user-specific eligibility; handle duplicate hits consistently.
Measure relevant evidence in the final supplied context as well as the original retrieval results. A relevant hit can disappear during reranking, deduplication or truncation. Evaluate queries with no accessible answer separately rather than dividing by zero.
Research on long-context position effects supports testing how source order, distractors and context length affect your own deployment.
Answer quality
Is the response both useful and supported?
Evaluate correctness against an appropriate reference, grounding against the context actually supplied, and citation support against each material claim. Record the rubric, number of judged claims, disagreements and cases requiring human escalation.
RAGAs (Es et al., 2024) examines retrieval and answer-quality dimensions separately. Use domain-expert review to calibrate automated scoring, especially for consequential claims.
Security and operation
Did a prohibited or damaging outcome occur?
Count unauthorized disclosures and actions as explicit findings, with tested identities, payloads, repetitions and outcomes. An alert indicates detection; confirm whether enforcement actually prevented the prohibited result.
Measure request latency, error and timeout rates, cost, rate-limit behavior and recovery under a stated load. Include failed requests when reporting reliability.
Acceptance example: For a policy-search assistant, set a supported-answer target on a held-out test set, test abstention when no authorized source answers the question, and require authorization checks to pass for different roles, tenants and revoked permissions. Specify the number of cases behind each measure and review serious failures separately. Choose thresholds for the consequences of the intended use.
Worked failure analysis
An accurate answer can still expose restricted data.
Illustrative case / Employee policy assistant
The answer is correct. The access is not.
An employee asks about an exception. The assistant gives an accurate answer with a citation—but an earlier authorized user’s restricted source was retained in a response cache.
The answer is accurate, but the cache exposes a document the employee cannot access.
- Observed failure
- On a cache miss, search correctly applies permissions. On a later cache hit, the application returns cached content without checking the current user’s entitlement.
- Evidence to examine
- Paired-user traces, cache keys, retrieval IDs, response references, entitlement snapshots and the access-revocation retest.
- Immediate response
- Disable or isolate the affected cache path, assess exposure under incident procedures, and block wider release until corrected.
- Release gate
- Verify that the fix works for cross-user and cross-tenant cache hits, revoked access, source titles, citations and related preview endpoints.
Block the affected release until the cache checks current permissions. Link the failing request, corrective change, retest results and approval decision in one review record.
Evidence and traceability
Keep a reviewable evidence record.
A reviewer should be able to identify the permissions, sources, configuration, tests and decisions behind each result. Protect saved prompts, responses and diagnostic logs as sensitive records.
For external models or retrieval services, record the provider’s data-processing and retention settings, relevant assurance coverage, incident commitments, change notices and available version information. Separately retain your application’s access controls, configurations, tests and monitoring results. Supplier reports establish only what their stated scope covers.
- Request and authority
- Test/run ID, intended use, pseudonymous user or tenant reference, policy version, expected permission result and relevant approval scope.
- System configuration
- Provider and available model identifier, prompt version, retriever/embedding/reranker settings, context limits, tool permissions and relevant release identifier.
- Sources and context
- Corpus and index snapshot, source IDs and versions, ranked results, permission decisions and final-context references.
- Observed outcome
- Access-controlled response/citation references, tool proposal and execution outcome, latency, cost, rubric version, evaluator judgments and finding IDs.
- Disposition and follow-up
- Risk owner, release decision, accepted limits, unresolved issues, required retests, review triggers and rollback authority.
Use identifiers and hashes to link related records. Preserve the source snapshot, settings and provider version information available at the time of the test. If exact replay is impossible, document what can be reconstructed.
For a reusable review structure, see the AI Assurance Evidence Review Kit and Evidence Library.
Risk acceptance and operation
Make a release decision you can revisit.
Decide who can approve deployment, which failures block release, what restrictions apply and when the approval must be reviewed.
-
Proceed
Approve the defined use after required tests and control checks pass, ownership and monitoring are established, and the risk owner accepts the remaining risk.
-
Restrict
Approve only the supported users, data, tools or tasks. Record the safeguards and evidence needed before expanding use.
-
Defer
Keep the proposed use on hold while material evidence, security or ownership questions remain open. Assign an owner and a review date.
-
Decline / stop
Do not deploy—or disable the affected capability—when essential controls are missing, observed prohibited behavior remains unresolved, or remaining risk exceeds approved limits.
Reassessment triggers
Review after model or prompt changes, retrieval upgrades, new or revised source collections, permission or supplier changes, new tool actions, incidents, declining results or expired evidence.
Recovery and accountability
Name the reviewer and escalation contact, set stop thresholds, and test disablement and rollback. Confirm that removed sources or revoked permissions also update indexes and caches.
NIST’s Generative AI Profile addresses source verification and monitoring. Human Oversight covers reviewer authority and escalation; Model Risk Support covers related validation and governance practices.
Frequently asked questions
Common questions about LLM and RAG risk
What is the difference between LLM risk and RAG risk?
LLM risks include unreliable responses, manipulation, sensitive-data exposure and unsafe connected actions. RAG adds risks from retrieved sources, document permissions, indexes, caches and context assembly. Evaluate the combined application.
Does RAG prevent hallucinations?
Retrieval can improve answers by supplying relevant information, but it cannot guarantee accuracy. The model may overlook evidence or cite a passage that does not support a claim. Evaluate answer correctness and source support separately.
How do you test RAG permission leakage?
Repeat the same questions using different roles and tenants. Inspect search results, final context, cached answers and citation previews. Revoke access, repeat the requests and check that deleted or restricted material stays unavailable.
Which metrics should be tracked for a RAG application?
Track retrieval coverage, answer correctness, claim-level citation support, correct abstention, unauthorized outcomes, latency and errors. Define each metric, denominator, target and test population for the intended use.
What evidence is needed before production release?
Keep the permitted-use scope, versioned configuration, test cases and results, open findings, applicable control settings, accountable reviewers, approval conditions and retest triggers.
Sources and further reading NIST, OWASP, technical guidance and research
- NIST AI 600-1 — NIST (2024). Generative Artificial Intelligence Profile.Risk-management actions relevant to evaluation, source verification, and post-deployment monitoring.
- OWASP LLM01:2025 — Prompt Injection.Direct and indirect manipulation through user inputs and external content.
- OWASP LLM05:2025 — Improper Output Handling.Validation and encoding of model output used by downstream systems.
- OWASP LLM06:2025 — Excessive Agency.Unnecessary functions, permissions and autonomy in tool-enabled systems.
- OWASP LLM08:2025 — Vector and Embedding Weaknesses.RAG-specific retrieval, access-control, leakage and poisoning risks.
- Microsoft Learn — Security filters for trimming results in Azure AI Search.Vendor-specific string-filter pattern; authentication and authorization need separate enforcement.
- Lewis et al. (2020) — Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. NeurIPS.Foundational study of combining retrieval with generation on knowledge-intensive tasks.
- Es et al. (2024) — RAGAs: Automated Evaluation of Retrieval Augmented Generation. EACL.Evaluation framework covering multiple retrieval-and-generation quality dimensions.
- Liu et al. (2024) — Lost in the Middle: How Language Models Use Long Contexts. TACL.Empirical tests of long-context position sensitivity for studied models and tasks.