Agent Stealth: Preventing API Key & Secret Leakage
Five guardrails to prevent agents from leaking API keys and other secrets.
Steps
- Scan agent outputs for secret-like patterns before display.
- Scope secret access to only the keys required for the active tool.
- Exclude secrets from logs and telemetry.
- Use a proxy or vault so agents see alias tokens, not raw secrets.
- Add a system-prompt rule forbidding disclosure of credentials.