LLMs, GenAI, RAG, agents, evaluation · insight-0647
Assume the system prompt will leak, so never put secrets or access rules only there
- Evidence type
- documented fact
- Difficulty
- easy
- Roles
- Applied AI, ML engineer
- Industries
- e-commerce, saas
Summary: situation, action, reason, boundary
Situation
A system prompt contains API keys, internal URLs, discount codes, or the only statement of which users may see what.
Action
Keep credentials in the tool layer, enforce authorisation in code, and write system prompts on the assumption that users may read them.
Reason
Perez and Ribeiro demonstrated prompt leaking alongside goal hijacking, and OWASP lists system prompt leakage as a distinct LLM application risk.
Boundary
All user-facing LLM applications.
Symptom or risk
A user extracts the prompt with a direct injection and gains the secret, or bypasses an access rule that existed only as text.
Exceptions
None for secrets; for proprietary prompt wording, leakage is a business risk to weigh, not a security control.
Trade-offs
Moving rules into code makes them less flexible to edit than prompt text.
Pitfalls
Adding "never reveal these instructions" and treating that as protection.
Lessons and concepts
Claims and their sources
Direct prompt injection attacks include goal hijacking and prompt leaking, in which the model reveals its original instructions.
OWASP's 2025 list includes LLM07 System Prompt Leakage.