Guides › Secure RAG › Vector database security
Vector Database Security
Securing a vector database means controlling who can query it, what each query is allowed to return, how tenants are separated, and what the stored vectors themselves reveal. Encryption at rest addresses none of those. It protects against someone stealing the disk, which is not how vector stores leak.
Why is encryption not the answer?
Because leakage happens through authorized queries against a decrypted index. The data is decrypted precisely when it is being used, which is when it gets returned to the wrong person. Encryption never engages in that path.
Encrypt anyway. It covers backup theft, disk disposal and a class of compliance questions you do not want to argue about. Just do not record it as the control that addresses retrieval exposure, because it is not related to it.
What actually needs securing?
Four things. Who can reach the database at all. What any given query is permitted to return. Whether tenants are genuinely isolated. And what the embeddings themselves disclose if someone obtains them.
Direct access to the index
Vector stores are frequently deployed with weaker controls than the systems whose content they now hold. A database that started as a prototype often keeps its prototype network posture and its shared credential long after it became the retrieval backbone for an internal assistant.
Query-scoped authorization
The application, not the database, usually decides what a user may see, and the database will faithfully return whatever the application asks for. If the retrieval service holds one credential with full read scope and applies filtering afterward, a bug in the application is a full index disclosure.
Metadata filtering applied before similarity search is the control that matters here. The mechanics are in RAG permissions.
Multi-tenant isolation
The 2025 OWASP Top 10 for LLM Applications lists LLM08, Vector and Embedding Weaknesses, and calls out multi-tenant context leakage specifically. How you implement separation decides whether a failure is loud or silent.
What the vectors themselves reveal
An embedding is not a one-way hash. Morris, Kuleshov, Shmatikov and Rush demonstrated in Text Embeddings Reveal (Almost) As Much As Text at EMNLP 2023 that embeddings can be inverted back to source text, recovering 92 percent of 32-token inputs exactly and reconstructing full names from a clinical notes dataset.
The practical consequence is that a vector export is closer to a text export than most governance frameworks assume. Covered further under embedding inversion.
What about the copies nobody governs?
Vector databases are rarely the only copy. Caches, conversation history, agent memory, evaluation datasets and debug logs all inherit content from the index and almost never inherit its permissions. OWASP moved Sensitive Information Disclosure up to LLM02 in the 2025 list.
Inventory the derived copies before hardening the primary store. Securing the database while an evaluation set of retrieved chunks sits in a shared bucket is not a meaningful improvement.
Where does the durable fix sit?
Upstream. Every control above governs a copy; content decisions made at ingestion govern the original, and every copy inherits them. Transformation before embedding means the chunk, the vector, the cache entry and the summary all carry the same reduced exposure without five separate policies.
That is the layer Hardshell works on, inside the customer's environment and upstream of the index.
Frequently asked questions
Is a managed vector database more secure than self-hosted?
On infrastructure hardening, usually yes. On retrieval leakage, it makes no difference, because that failure happens inside an authorized query either way. Choose on operational grounds and treat the entitlement question as yours regardless of hosting.
Should we encrypt embeddings themselves?
You cannot meaningfully, and still search them. Similarity search requires comparable vectors. Approaches that operate on encrypted vectors exist in research but are not practical at production latency. Reduce what the vectors encode instead.
Does deleting a document remove it from the index?
Only if your pipeline propagates deletions, and many do not. Deletion in the source system frequently leaves orphaned chunks that remain retrievable. Test this explicitly, because it is a common and awkward finding during a data subject request.
What should we log?
Which chunks were returned, for which query, to which identity, at what time. That record is the prerequisite for auditing, for investigating an incident, and for running a leakage self-test. Without it you cannot answer what a given user was shown last week.
