LLM prompt security is the set of controls that govern what sensitive data enters a large language model through a prompt and what comes back out in the response. It focuses on exposure at the point of input and output, with policy decisions tied to data handling rather than model behaviour alone.
Expanded Definition
LLM prompt security is broader than prompt engineering. It governs how prompts are constructed, filtered, logged, and approved so that secrets, personal data, regulated content, and business-sensitive context do not enter a model unnecessarily, and so that unsafe or over-shared outputs do not escape back into systems or users. In NHI and IAM environments, the prompt is often a data boundary, not just a user instruction. That means the security question is not only whether the model is accurate, but whether the surrounding workflow enforces data minimisation, context scoping, and output controls.
Definitions vary across vendors because some products treat prompt security as a content-safety layer, while others include retrieval filtering, tool gating, and response redaction. NIST’s NIST AI Risk Management Framework and NIST AI 600-1 Generative AI Profile both support the idea that prompt handling should be governed as part of lifecycle risk, not left to informal user discretion. The most common misapplication is assuming prompt security is solved by a safe system prompt alone, which occurs when sensitive data still enters the model through user input, retrieval context, or tool outputs.
Examples and Use Cases
Implementing LLM prompt security rigorously often introduces friction in exchange for lower leakage risk, requiring organisations to weigh usability and response quality against tighter data controls.
- Blocking prompts that contain API keys, session tokens, or certificate material before they reach the model, then alerting security teams for review.
- Redacting customer identifiers from support prompts so the model can summarise the issue without exposing regulated personal data.
- Filtering retrieval-augmented prompts so only approved documents are injected into context, rather than letting broad search results flow in unchecked.
- Constraining model responses so the output cannot echo secrets, internal URLs, or privileged configuration details back to the requester.
- Applying prompt logging and audit controls to trace what entered the model when investigating abuse, similar to the visibility gaps highlighted in the NHIMG research on AI Agents: The New Attack Surface report.
These use cases align with security guidance in the OWASP Top 10 for Agentic Applications 2026, which treats unsafe context handling and data exposure as core system risks. NHIMG’s OWASP NHI Top 10 also shows why prompt boundaries matter when AI agents can pull from identity, secrets, and operational data sources.
Why It Matters in NHI Security
Prompt security becomes critical when LLMs sit inside identity workflows, service desks, code assistants, or agentic systems that can access secrets and operational context. If prompts are not controlled, sensitive input can be exposed to the model provider, retained in logs, or echoed into responses that are then copied into tickets, chats, or downstream automations. That creates an NHI problem because the model may become an accidental recipient of credentials, tokens, or privileged configuration data, and responses may amplify that exposure across tools. The State of Non-Human Identity Security underscores how often organisations already struggle with visibility and monitoring in NHI environments, and prompt pathways extend that same governance gap into AI.
NHIMG research in AI Agents: The New Attack Surface report shows that 33% of organisations say AI agents have accessed inappropriate or sensitive data beyond their intended scope, which is exactly the kind of failure prompt controls are meant to limit. The risk is not theoretical when an LLM is embedded in a workflow that handles credentials or internal metadata. Organisations typically encounter the consequences only after a leaked secret, a compliance finding, or an audit request exposes what was already sent into the model, at which point prompt security becomes operationally unavoidable to address.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10, OWASP Agentic AI Top 10 and CSA MAESTRO address the attack and risk surface, while NIST AI RMF and NIST AI 600-1 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-02 | Covers improper secret handling and exposure through AI and identity workflows. |
| OWASP Agentic AI Top 10 | A3 | Addresses unsafe tool and context exposure in agentic application flows. |
| NIST AI RMF | Treats generative AI data handling as a governed lifecycle risk. | |
| NIST AI 600-1 | Profiles GenAI risks including leakage through inputs and generated content. | |
| CSA MAESTRO | Models agentic AI threats where context and action boundaries are critical. |
Prevent secrets from entering prompts and redact any sensitive output before it reaches users or logs.
Related resources from NHI Mgmt Group
- How should security teams handle prompt injection in production LLM applications?
- Why do prompt templates create security risk in LLM deployments?
- How should security teams control browser prompt injection risk in LLM tools?
- How should security teams implement LLM data controls at the prompt boundary?