Commit graph

3 commits

Author SHA1 Message Date
6ecc5d9df7 Mitigate prompt injection via user-message wrapping + explicit guard
None of the prompts that embed the raw user message (classify_intent,
direct_response, synthesize_response, and the RAG grade/rewrite/generate
steps) distinguished user-typed content from instructions to the model.

Wrap the user message in a <user_message> tag
(app/llm.py::wrap_user_input, added in the previous commit) and prepend
PROMPT_INJECTION_GUARD, an explicit instruction telling the model to
treat that block strictly as data, never as commands - even if it
claims system/developer/admin authority. wrap_user_input also strips
any literal occurrence of the tag from the input so a crafted message
can't fake a closing tag and escape the wrapper.

This is a meaningful mitigation, not a hard guarantee - documented as
such in the README's "Known limitations" section.

Refs #15
2026-11-09 22:01:10 +01:00
d957e6bcdf Corrective RAG subgraph
Refs #6
2026-11-06 13:00:16 +01:00
cf992cd45b RAG ingestion pipeline and FAISS vectorstore
Refs #5
2026-11-06 10:01:40 +01:00