Join our Newsletter — 33% off our NHI Course

How should organisations handle untrusted documents in AI workflows?

Treat every external document as potentially hostile until inspection proves otherwise. Compare the visible version with the extracted text, label the content as untrusted, and prevent the model from using it as an instruction source. If the workflow can trigger tools or decisions, require a separate approval step for high-impact actions.

Why untrusted documents need a hostile-input mindset

Documents inside an AI workflow should be treated as data first, not as authority. A PDF, slide deck, or pasted text can carry hidden instructions, misleading citations, or content that differs from what a user sees on screen. The core control is to keep the model in a narrow role: extract, classify, or summarise the document, but do not let the document redefine the task.

That distinction matters because AI systems are often asked to combine retrieval, summarisation, and action. If the workflow cannot cleanly separate instructions from content, the document can become a covert control plane for the model. A safe workflow assumes the document may try to influence tool use, policy decisions, or downstream outputs unless the system explicitly prevents that.

For teams building document-heavy AI features, the most important design choice is whether the document is ever allowed to compete with system instructions. If it is, the workflow is already too permissive. The safer pattern is to treat the document as an untrusted input object, then apply inspection, labelling, and constrained processing before any generation step.

How to inspect and constrain document handling

Start by comparing the visual rendering with the extracted text. That catches cases where the visible page looks harmless but the underlying text includes hidden prompts, malformed content, or instruction-like phrases that should not be followed. The inspection step should also preserve provenance, so reviewers can tell whether the model is reacting to the user’s prompt or to the document itself.

Next, label the source as untrusted at ingestion and keep that label attached through the full workflow. The label should influence routing, prompting, logging, and approval logic. A document that came from email, a public site, or an external upload should not silently move into the same trust bucket as a curated internal knowledge source.

When the workflow supports tool calls, the document must not be able to trigger irreversible actions on its own. The model can draft a recommendation, but a separate decision point should gate anything with operational impact, such as sending messages, changing records, or initiating transfers. That separation keeps the document from acting as an instruction source with execution authority.

What safe handling looks like when the workflow can act

A safe document workflow defines boundaries at the point where interpretation becomes execution. The model may analyse untrusted material, but the surrounding application decides what is allowed to happen next. That usually means strict input segmentation, a clear system prompt that rejects embedded instructions, and a policy layer that constrains which tools are available for that task.

Where the workflow is used for triage or decision support, keep the document’s outputs advisory unless a human or a higher-trust policy confirms the action. This is especially important when the document may influence prioritisation, eligibility checks, or exceptions. The more the workflow can affect the outside world, the more important it is to require explicit approval for high-impact steps.

For operational teams, the practical question is not whether the document is malicious in the abstract, but whether it can change the model’s behaviour in a way that escapes review. If the answer is yes, reduce the document’s authority, narrow the tool set, and make the approval boundary explicit before deployment.

Risk and Threat Considerations

Untrusted documents can be used to smuggle instructions, manipulate retrieval, or steer an AI system toward unsafe tool use. The main exposure is not just bad output, but delegated action under false authority, where the model treats adversarial content as part of the task.

Failure mechanism: The workflow fails when it does not separate content from instruction, so embedded text can influence prompts, retrieval results, or tool calls. Hidden or conflicting instructions can then bypass the intended trust boundary.

Impact: The result can be data leakage, wrongful decisions, unsafe automation, or malicious side effects in connected systems, especially when the model has permission to act beyond summarising or classifying the document.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP API Security Top 10 and OWASP Agentic AI Top 10 address the attack and risk surface, while NIST SP 800-53 Rev 5 sets the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
NIST SP 800-53 Rev 5 AC-3 — Access Enforcement Controls which actions AI workflows may execute after document analysis.
SI-10 — Information Input Validation Covers validating untrusted document content before it is processed by the system.
AU-2 — Event Logging Supports traceability for untrusted document handling and approval decisions.
Recommendation — Enforce decision gates before any document-driven tool action occurs. Validate and constrain extracted document input before model use. Log document ingestion, inspection, and approval events for review.
OWASP API Security Top 10 API5 — Broken Function Level Authorization Applies when AI workflows can invoke functions from document-influenced decisions.
Recommendation — Restrict which functions the workflow can call after document analysis.
OWASP Agentic AI Top 10 ASI02 — Tool Misuse Relevant when untrusted documents can steer an agent into unsafe tool calls.
Recommendation — Constrain tool access so documents cannot drive unauthorized actions.

Practitioner Guidance

What to verify: Confirm that the workflow has an explicit trust boundary between document content and system instructions, and that extracted text is inspected before it is allowed to influence generation or tool selection. If the workflow cannot show that boundary, treat it as unsafe by default.

Decision rule: If a document can affect any action with external consequence, require a separate approval step and keep the model’s output advisory until that approval occurs. If the task is purely descriptive, constrain the model to extraction and summarisation only.

Common mistake: Teams often secure the model prompt but forget that the document itself can become a prompt carrier. The safer design is to harden the ingestion path, not just the chat or generation layer.

Practitioner takeaway: The objective is not to make every document trusted, it is to ensure that untrusted material can be examined without being granted authority to instruct the model or trigger action.