0 views
What security issues arise when RAG processes user input (for example, in customer support), and how can they be prevented?
Asked at
AI answer
The main risks are prompt injections (including in messages and documents), data leaks from context or history, mixing data from different users, malicious or erroneous documents in the database, and unsafe execution of actions through tools.
Practical measures:
- Treat user input and retrieved documents as untrusted data; explicitly separate them from system instructions. Do not rely solely on prompt instructions to defend against injections.
- Check access permissions before retrieval and filter documents by user or organization; do not put secrets in context unless necessary.
- Restrict the tools available to models and their permissions, validate arguments, and require human confirmation for significant actions.
- Verify the sources and contents of indexed documents, audit changes, and support deletion of outdated or compromised data.
- Minimize and mask personal data, protect logs, and limit the volume and frequency of requests.
- Test the system for injections, leaks, and cross-user access; monitor incidents and have a mechanism for stopping dangerous operations.
Also asked at OZON
- Tell us about yourself and your work experience.
- Name several types of classification metrics and explain them.
- How are Recall and Precision related, and is it possible to improve one without decreasing the other? Provide examples of tasks.
- How are MAP and MRR metrics calculated in ranking tasks?
- Tell us about the parameters of generation: temperature, Top-P, and Top-K.
Similar questions
- How would you build a system that detects and removes prompt injection from arbitrary user text, including identifying the boundaries of the malicious fragment?
- How can you ensure corporate data is secure when using an external LLM via an API?
- Have you encountered scenarios where users try to hack the system (prompt injection) and take control, and how did you defend against them?
- Imagine that a RAG search finds several documents that contradict one another, and they are passed to the model. Could this happen, and how can you address it?
- Why can’t prompt injection be solved using system prompts alone?