Where secrets enter prompts and agent workflows
Secrets reach an LLM through more than one path, so the first step is to map every place text can enter a prompt. The entry vectors in this guide are:
- Chat
- IDE assistants
- Tool outputs
- Retrieved context
Inspecting text at every one of these entry vectors is what makes the prompt path a reliable control point.
Entry vectors mapped to primary controls
Once entry vectors are mapped, each prompt passes through four control points: entry, inspection, enforcement, and audit.
| Stage | Description |
|---|---|
| Entry | Chat, IDE assistants, tool outputs, retrieved context |
| Inspect | Pattern, entropy, format, and validation checks |
| Enforce | Block, redact, or warn at the gateway, client, or SDK |
| Audit | Decision metadata logged without the secret |
Choosing detection techniques and measuring them
The inspection stage combines several kinds of checks. Each one looks at the text from a different angle:
- Pattern: matches known credential shapes.
- Entropy: flags strings that look random.
- Format: checks whether a string fits an expected structure.
- Validation: confirms whether a candidate is likely to be a real secret.
High-confidence secrets are the ones to block or redact inline, so choose and combine techniques with that outcome in mind.
Enforcement points, latency, and coverage gaps
Policies can block, redact, or warn. Enforcement can sit at the gateway, the client, or the SDK, and each location covers a different part of the prompt path. Compare your enforcement points against the entry-vector map to find coverage gaps, and weigh inline enforcement against the latency it adds to each request.
Detection alone is not enough. Keep credentials out of model context through brokering and short-lived tokens, so a secret that is missed at inspection has less to expose.
Logging enforcement without retaining the secret
Log each enforcement decision with metadata only. The audit record should show that a decision was made, and it should never contain the secret value. This keeps the audit trail useful for review without creating a second place where the credential is stored.
Where runtime governance fits
Runtime policy enforcement and audit logging connect the stages above into one controlled prompt path. They apply inspection results at the point of use and record each decision as metadata.