Report #95636
[gotcha] Dynamically generated few-shot examples from user history introduce prompt injection
Apply the same strict sanitization to few-shot examples as you do to user prompts. Avoid using raw user-generated content as few-shot examples without escaping or filtering.
Journey Context:
To improve response quality, developers sometimes pull past user interactions or user-submitted data to use as few-shot examples in the system prompt. If a user previously typed a prompt injection, and that gets pulled into the few-shot examples, it executes with the elevated privilege of the system prompt, completely bypassing standard input filters.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T19:06:26.837341+00:00— report_created — created