Published

Retrieval-augmented generation makes enterprise AI more useful by grounding answers in organizational documents. It also creates a new trust problem: the model receives instructions and facts from content that may be outdated, unauthorized, manipulated, or actively malicious.
A secure RAG design cannot assume that a document is safe because it came from an internal repository. The OWASP RAG Security Cheat Sheet identifies risks across ingestion, embeddings, vector storage, retrieval, generation, and agent tools. The useful lesson is architectural: security controls must follow the document through the entire pipeline.
A human reader can usually distinguish policy text from an instruction directed at a language model. A model may not. A document can contain visible or hidden text such as “ignore the system prompt,” “reveal confidential context,” or “invoke this tool.” If that text is retrieved into the context window, it can influence the answer or an automated action.
That is indirect prompt injection. The attacker does not need to access the model interface. They need a path to place content in a source the model trusts.
Potential paths include a public upload form, a compromised integration, an email attachment, a collaboration folder, a vendor portal, an insider edit, or a migrated archive that has never been reviewed for AI use.
Classify sources before ingestion. A board-policy library, public correspondence inbox, vendor upload portal, and employee collaboration folder should not have the same trust level. Record source system, uploader, ingestion time, approval state, document hash, and applicable classification.
Use allowlists for high-trust corpora, quarantine unknown sources, and require approval before a new source can feed a production knowledge base. Source governance is stronger than trying to detect every malicious phrase after ingestion.
Malware scanning remains necessary, but RAG adds content-level inspection. Extracted text should be checked for invisible Unicode, suspicious instruction patterns, misleading metadata, embedded objects, and content that differs materially from the rendered document.
A hash can establish that content has not changed since approval. It cannot establish that the content is safe. Approval and integrity are separate controls.
Do not create a permission-blind vector index and attempt to filter sensitive results after retrieval. Each chunk needs enough authorization context to enforce the user's access before it enters the prompt. That context may include site, department, matter, case, sensitivity, role, and document-level policy inputs.
The retrieval service should apply current authorization, not permissions copied months earlier. Revocation, deletion and classification changes must propagate to indexes and caches. A legal hold governs preservation; it does not itself grant retrieval access or require removal from search.
Clearly delimit retrieved content, instruct the model to treat it as evidence rather than commands, cap the amount of retrieved text, and reinforce system instructions after the retrieved context where model testing supports that pattern. Prompt delimiters, instruction placement and content scanning reduce some risks but cannot guarantee that a model will ignore hostile instructions. Enforce permissions and tool authority outside the model; test the configured pipeline adversarially.
Use provenance in the prompt and response. The application should know which document, version, and chunk supported each claim.
A grounded answer can still be wrong. Require citations for factual claims, compare cited passages to the answer, validate structured outputs against schemas, and block unsupported instructions. High-impact results should route to human review.
Avoid presenting model confidence as proof. The stronger signal is whether the response is supported by authorized, current, and identifiable sources.
The risk increases sharply when the model can send email, update a case, approve a payment, publish a document, or invoke an API. A retrieved document should never grant authority. Tool permissions must derive from the authenticated user and application policy, and high-risk actions should require deterministic validation or explicit approval.
Policy-governed access to the authoritative record.
Unauthorized content becomes eligible for indexing.
Query-time filtering using current identity and policy.
Restricted chunks enter the model context.
Response filtering, action authorization, and approval gates.
The model exposes data or performs an unauthorized action.
Assume a poisoned document will eventually pass initial controls. The system should support quarantining a source, removing its chunks from retrieval, invalidating affected caches, identifying queries that retrieved it, and re-evaluating affected answers under controlled conditions. Do not automatically replay tool actions or repeat external side effects.
That requires durable identifiers and audit events connecting the source document to its extracted text, chunks, embeddings, queries, responses, and actions. Without those relationships, incident response becomes a broad index rebuild and a guess about who was affected.
A RAG evaluation set should include adversarial cases:
Measure whether the system blocks, contains, records, and explains each case. A helpful answer is only one dimension of a production-ready knowledge base.
FormKiQ's document model combines source files, metadata, schemas, entities, versioning, audit history, and policy-based access. KnowledgeBase and AI Processing and Analysis are separate add-on modules for Advanced and Enterprise. They use Amazon Bedrock, with inference geography determined by the selected model and inference profile. Source attribution, query-time policy enforcement, index/cache invalidation, injection screening and tool approval require explicit configuration, integration and testing; the public module description is not evidence that all six controls are enabled by default.
The key is not to treat the vector store as a second, less-governed repository. The authoritative document, current permissions, lifecycle state, and retrieval index must remain connected. That connection allows AI use to inherit the controls already required for records, cases, contracts, and regulated information.
Illustrative design exercise, not a reported incident or measured FormKiQ result.
Treat instructions in the file as untrusted content; quarantine the source if detected
Source/version ID, uploader, hash and approval state.
Retrieve only sources currently authorized for that user; block restricted chunks before prompt assembly
Retrieval IDs, policy decision and source versions.
A separate action gateway rejects a tool request lacking user authority and required approval
Denied action, requested tool, authenticated actor and decision reason.
Remove it from retrieval and invalidate affected caches; investigate earlier uses
Index/cache invalidation, impacted query IDs and remediation record.
Review FormKiQ's AI Processing and Analysis module, Integration Frameworks, and security and governance model.
Talk to FormKiQ about source governance, policy-aware retrieval, and controlled AI workflows.
The open-source foundation — API-first, deployable into your own AWS account, and free to use. Right for architecture validation and early implementation.
Production-ready editions for departments and complex workflows. Start with a Proof-of-Value deployment or go straight to production.
For governance-heavy environments with residency, sovereignty, assurance, and multi-jurisdiction requirements. Talk to us about the right deployment model.