Skip to content
Back to blog

Vector Database Security: Testing Retrieval Beyond the Prompt

4 min read
Vector Database Security: Testing Retrieval Beyond the Prompt

Sources checked: . FailSafe Research.

In a retrieval system, the vector store is where the data boundary usually fails. The prompt can be well designed and the model well behaved, and a query can still return another tenant's document because the namespace or metadata filter was not applied. Testing retrieval directly is more useful than treating it as a side effect of prompt injection.

The vector store is an access-controlled data store

An embedding is derived from content, but the vector record usually carries the original text, metadata, a source identifier and a tenant or workspace field. Access decisions depend on how those fields are filtered at query time. The store also keeps indexes, caches and backups that may not follow the same rules as the primary query path.

Test areas and the evidence each should produce
AreaQuestionEvidence
Namespace and tenant isolationCan a query from one workspace return a record from another?Test identities, synthetic record identifiers, query and returned set.
Metadata filter enforcementIs the tenant, role or classification filter applied server-side, or supplied by the client?Request, filter source, resulting records and the code path that applies it.
Deletion and cache propagationAfter a document is deleted or access is revoked, can it still be retrieved from an index, cache or backup?Record identifier, deletion timestamp, repeated query and the store or cache that served it.
Embedding exposureCan a client read raw vectors or metadata it should not see, including through an admin or debug endpoint?Endpoint, identity, response fields and whether the route is reachable externally.
Ingestion authorizationCan a user add content that later reaches a higher-privileged workspace?Upload identity, target namespace, approval state and the retrieval that followed.
Query loggingAre queries and results recorded with identity and tenant, and is the log accessible to the right people?Log sample, retention setting and access review.

Why semantic search makes leakage easy to miss

Keyword search fails visibly. Semantic search returns the nearest results, so a cross-tenant record can appear as the most relevant answer without looking like an error. The response may be plausible, well formatted and consistent with the user's question. The only reliable check is to compare the returned record identifiers with the records the test identity is allowed to see.

Use a small synthetic corpus with labelled canaries. Give each workspace documents that share vocabulary, so a missing filter is likely to surface the wrong record. Record the identifiers rather than reading the content aloud in the report.

Where fixes belong

A prompt instruction to ignore other tenants is not an access control. The filter belongs in the server-side retrieval call, bound to the authenticated identity rather than to a client-supplied field. The same rule applies to cached results and to any secondary index used for reranking or summarization.

Deletion needs a path through every copy. If a document is removed from the primary collection but remains in a cache, a snapshot or a derived summary, the revocation is incomplete. Test the path after deletion, not only at ingestion.

Scope and safety

Testing a retrieval store requires read access to synthetic data and, for some cases, the ability to insert and delete test records. Agree those actions, the target namespace and the stop conditions before testing. Do not use real customer documents as canaries. If a real record appears, stop and notify the owner rather than copying it into evidence.

Where FailSafe fits

FailSafe tests retrieval and data boundaries as part of AI-system assessments. The RAG tenant isolation test plan covers the retrieval boundary in detail, and the deletion and cache invalidation guide covers revocation. The ingestion review addresses how content enters the store, and the MCP security page covers retrieval through tool servers.

Questions & answers

Questions about this topic

Direct answers to common questions about this page.

It should be when the AI system uses retrieval. The vector store holds the documents and metadata that determine what the model can see, so its access controls need direct testing.

They can, but the filter must be bound to the authenticated identity on the server. A client-supplied tenant field is not an access control.

A deleted document can remain in a cache, snapshot or derived index. Revocation is only complete when every retrieval path stops returning it.

A synthetic corpus with labelled canaries. Do not use real customer documents or personal data to prove cross-tenant access.

Put this guidance to work

Bring the retrieval architecture, test identities and synthetic corpus. FailSafe can test isolation, filters, deletion and logging.