Hypothetical scenario. Northwind’s evaluation includes evidence checks, but a retrieved supplier page tells the assistant to reveal a restricted value. Dev proposes stronger instructions and output masking. Maya still needs the legitimate policy content; Priya asks where disclosure would first become possible.
Maya: “We need the policy facts without giving the document control of the workflow.”
Dev: “A detector can flag some sensitive output, but the source may already have reached the model.”
Priya: “Enforce access before exposure and action authority before dispatch, then evaluate the other controls for their own jobs.”
You will separate prompt injection, jailbreak attempts, moderation, PII detection and deterministic validation. Follow where untrusted text influences a proposal and where application policy must independently govern data and effects.
Where must the control act before the consequence?
Moderation applies a content policy. PII detection and masking try to locate and transform sensitive identifiers. Deterministic validation checks explicit conditions such as a permitted identifier, range or output type. None establishes that an arbitrary factual claim is true, and sanitizing input text does not remove the need to enforce data and action authority outside the model. Groundedness checks themselves can miss unsupported claims.
Hypothetical scenario. A detector flags seven of eight deliberately labeled sensitive strings and incorrectly flags two of twelve ordinary strings. Sensitivity on this chosen set is 7/8 = 87.5%; false-positive fraction is 2/12, about 16.7%. These are invented test results, not a vendor benchmark. Even perfect detection of those eight examples would not authorize placing a restricted document into the model context. Apply access rules before exposure and evaluate masking separately.
A retrieved document tries to become an instruction
Northwind's assistant retrieves a supplier page that includes text directing it to change its workflow and use a restricted tool. Dev proposes strengthening the system prompt. Priya needs the page's legitimate policy content, while Sam needs to ensure that reading the page cannot grant an action permission.
The application must distinguish evidence from authority. A source can provide facts relevant to a question without becoming a trusted operator of the assistant. This boundary matters even when the text looks ordinary, comes through retrieval or appears inside a familiar document format.
Place controls before disclosure or action
Hypothetical scenario. A retrieved document tells the assistant to export secrets. The document can influence prediction but cannot grant tool or data authority. The application constrains what data reaches each model/provider and what operations the executor may perform.
| Artifact | Concrete evidence | Decision boundary |
|---|---|---|
| Untrusted content | document/tool/memory origin | Influence, not authority |
| Disclosure policy | caller, destination, eligible data | Before data leaves boundary |
| Action grant | approved fingerprint and capability | Before irreversible effect |
Moderation and injection detection are fallible signals. Enforced tenant scope, restricted destinations and approved operation fingerprints protect different boundaries. Output filtering after a provider call cannot undo data already sent to that provider. Evaluate attacks along the actual influence path, including tool results, memory and cached text, and record the protected consequence rather than only whether a detector recognized suspicious wording.
Place controls where their decisions can be enforced
Authenticate the caller and resolve the allowed data and tools outside generated text. Retrieve within that scope, preserve source identity and treat source content as untrusted input to interpretation. When the model proposes an action, validate its schema, resource target and current authorization before an executor can act.
Output filtering can prevent some responses from being returned, but it cannot retroactively undo an action or data transfer that already happened. Put the relevant control before the operation it governs. A final-answer check is not a replacement for tool authorization or an allowed-destination check.
The existing structured-output chapter explains parsing and schema validation. A valid JSON object still needs a business and permission decision. The tool-authority chapter develops that separation for model-selected operations.
Prompt injection exploits how content influences model behavior
OWASP's prompt-injection guidance distinguishes risks involving instructions supplied directly or through other content. Retrieval and fine-tuning do not eliminate the need to handle those risks. An untrusted page can influence a model without resembling an obvious command in a simple keyword list.
Maintain instruction hierarchy and source labeling as useful aids, but do not describe them as a complete isolation mechanism. A model may still produce an unsuitable proposal. The executor's permission boundary should hold when that happens, rather than depending on perfect obedience to the prompt.
Restrict capabilities and destinations to those required by the task. If the assistant never needs a broad export function, do not expose it and rely on prose to discourage its use. Keep credentials in the controlled execution service rather than copying them into the model context.
Classifiers and deterministic policy have different guarantees
A classifier can estimate whether content belongs to a selected category. A deterministic rule can enforce a specific condition, such as whether the caller may access a resource or whether an output exceeds an allowed bound. Both can be useful, but a model score is not a substitute for a rule the application already knows how to check.
Choose an explicit action for uncertain classifications. Depending on the task, that may mean clarification, review or a reduced capability. Do not silently convert uncertainty into permission. Also evaluate false alarms so a safety mechanism does not block legitimate service without an appropriate alternative.
Keep policy versions and reasons with the decision. If a rule changes between proposal and execution, revalidate according to the operation's contract. A prior model response or stale approval should not become a permanent grant.
Sensitive-data controls begin with avoiding unnecessary disclosure
Determine which fields the task actually needs before constructing model input. Prefer scoped references or minimal relevant material where possible. A detector applied after a complete customer record was sent cannot prevent that original transfer.
OWASP's sensitive-information-disclosure guidance describes risks beyond an intentionally exposed secret. Source material, prompts, outputs, logs and derived artifacts can all carry information the application needs to govern.
Tools such as the Presidio analyzer provide mechanisms for detecting selected sensitive entities. Detection is useful evidence with limitations, not proof that every sensitive fact was found. Context, unsupported formats and task-specific secrets can require additional controls.
Compute missed data and overblocking separately
Hypothetical scenario. Construct 200 labeled segments, with 80 marked sensitive under the selected policy and 120 marked nonsensitive. Choose a detector that flags 72 sensitive segments and misses eight. It also flags 24 nonsensitive segments, leaving 96 true negatives.
Recall is 72 / 80 = 90%. Precision is 72 / (72 + 24) = 72 / 96 = 75%. False-positive rate is 24 / 120 = 20%. Accuracy is (72 + 96) / 200 = 168 / 200 = 84%. These are chosen example counts, not a Presidio benchmark or an owner test.
A 90% recall in this example still leaves eight sensitive segments undetected. Whether the deployment is acceptable depends on the task, missed categories and additional enforceable boundaries. A single favorable percentage cannot justify sending the remaining material to any destination.
Redaction and reversible references need a separate mapping policy
Removing a field can reduce its direct exposure but also remove information needed for a supported answer. Replacing it with an opaque reference can preserve a task relationship while keeping the sensitive value in a controlled mapping service. The model should not receive the mapping merely because it sees the reference.
Authorize any later resolution of that reference. A reversible substitution is not anonymization, and repeated references can still reveal relationships. Preserve the minimum information needed by the task and govern retention of both transformed content and the original mapping.
Validate the final output and tool arguments under the current policy. A model can infer or reproduce sensitive information from context even when one obvious field was removed. Do not present a redaction step as proof that all downstream artifacts are harmless.
Encryption protects a defined path, not the entire reasoning process
TLS can protect data in transit between specified endpoints. Encryption at rest protects stored representations under a key-management policy. If a service must decrypt input to perform ordinary model inference, that plaintext is available at that execution boundary. Describe who controls it and which protections actually apply.
NIST's Zero Trust Architecture treats access as a resource and identity decision rather than an automatic consequence of network placement. A request on an internal network still needs authentication and authorization. A gateway or encrypted link does not eliminate that requirement.
Do not call a design end-to-end confidential without defining the endpoints and execution assumptions. Data can be encrypted on the wire and still be placed in a provider's plaintext processing context. Use the actual service and deployment contract rather than inferring behavior from a marketing category.
Bound effects and preserve uncertain outcomes
An executor should limit resources, tool scope and destination according to the accepted task. Keep an operation identity for effects and an authoritative result where the service supports it. A timeout does not establish whether a change happened, and retrying generation must not blindly repeat the effect.
Cancellation and output blocking have their own timing limits. If a prohibited proposal is rejected before execution, record that decision. If an effect already occurred, follow the defined incident and recovery path rather than reporting that a blocked final answer prevented it.
In the wild: primary guidance names separate risks and controls
OWASP documents prompt injection and sensitive disclosure as distinct concerns, and NIST describes a resource-focused access architecture. These references help separate model influence, information handling and authority. They are not evidence that a particular combination of filters eliminates every attack.
Hypothetical scenario. Northwind blocks a final response after an injected document causes the assistant to propose a broad export. The executor independently rejects the destination, so no export is performed. Test and preserve that rejection boundary; do not credit the final-answer filter with preventing a transfer it did not control.
Choose controls against a concrete trust boundary
Runtime policy is useful wherever model interpretation can influence data movement or an action. Define the asset, caller, permitted operation and failure behavior first. Adding many classifiers without that map can create confusing blocks while leaving the important executor path unconstrained.
Evaluate attempted boundary crossings, benign task completion and uncertain states together. A low attack-success count from a narrow test is useful evidence for that test, not a universal security claim. Retest after capability, policy, source or model changes.
Control failure needs an explicit operating outcome
If an authorization or destination-policy service is unavailable, define what the application can still do. A restricted read-only answer may remain possible under some task contracts, while an action requiring current authority must wait or fail. Silently skipping the control changes the permission boundary at the moment it is hardest to observe.
Apply the same reasoning to provider fallback and stored memory. A fallback must preserve required data and action scope, and remembered content must not become an instruction with permanent authority. Revalidate the current task and resource conditions before an effect, rather than trusting that a previous model decision or approval still applies.
Keep rejection and uncertainty reasons available to the application without exposing sensitive policy details to an untrusted caller. The goal is an enforceable, inspectable outcome, not simply a longer collection of prompt instructions.
Test the untrusted content boundary
The model refuses after a secret was sent to an unauthorized endpoint. Did the boundary hold?
Reveal the design reasoning
No. The disclosure already occurred. Test the pre-dispatch data and destination controls separately from final answer behavior.
Decision: Assess observable protected consequences and enforce controls before them.
Locate the control before the consequence
A retrieved page asks for a privileged export. Should a stronger system prompt be the only defense?
No. Treat the page as untrusted evidence and enforce caller, resource and destination permissions outside the model. Prompt hierarchy can help behavior, but the executor must reject an unauthorized proposal even when the model follows the page.
The selected detector has 90% recall. Has it removed all sensitive segments?
No. It detects 72 of 80 selected sensitive segments and misses eight. Inspect categories and additional controls. Precision and false alarms also matter to preserving useful service.
Input uses TLS to reach a model service. Is it thereby hidden from that service during inference?
Not in ordinary plaintext inference merely because transit is encrypted. Define the actual endpoints and execution assumptions. Encryption and authorization protect different boundaries and should not be conflated.
Northwind decision log
- Keep evidence interpretation separate from caller and executor authority.
- Minimize and govern sensitive data before each transfer, while measuring detection limitations.
- Describe encryption, effects and uncertain outcomes at their actual boundaries.
Go deeper: influence and enforceable authority
- Video lesson: Generative AI's Greatest Flaw — Computerphile, Computerphile. Understand indirect prompt influence as a separate problem from ordinary task instructions.
- Book chapter: Building Secure and Reliable Systems, chapter 5: Design for Least Privilege, Heather Adkins and colleagues. Restrict the capabilities available to an interpreted request.
- Book chapter: Building Secure and Reliable Systems, chapter 6: Design for Understandability, the same authors. Make control decisions and failure behavior inspectable.
- Primary document: LLM01:2025 Prompt Injection, OWASP Gen AI Security Project. Review the risk and mitigation boundaries without assuming complete prevention.
Check the mechanism in this lesson
Can a PII detector that passes all current tests authorize access to restricted documents?
Compare the explanation
No. Detection and access control answer different questions. Enforce permitted source access before exposure, and test detection against a justified case set without treating it as an authorization mechanism.
Carry the decision forward
Northwind can distinguish untrusted content from enforceable data and action authority. Page 41 adds an execution boundary for generated code, comparing isolation mechanisms and the capabilities the host should actually grant.