TL;DR: AI agents with file, shell and network access can accidentally leak API keys, OAuth tokens and conversation history into logs, chat channels or external services unless layered protections block secret exposure before, during and after execution, according to Codenotary. The governance problem is issuance-time control, not cleanup after disclosure.
Editorial analysis by NHI Mgmt Group, based on content published by Codenotary: “Preventing AI Agents from Leaking Your Secrets”.
Key questions
Q: How should security teams keep AI agents useful without letting them see secrets?
A: Use a credential broker or proxy so the agent can make authorised requests without ever handling the underlying tokens, API keys, or certificates.
Q: Why do AI agents complicate identity governance compared with human users?
A: AI agents complicate identity governance because they act autonomously, can change tasks quickly, and often use multiple secrets, APIs, and delegated privileges across systems.
Q: What are the signs that shadow AI is leaking secrets?
A: Look for prompts containing API keys, tokens, connection strings, customer data, or regulated information, especially when the same workstation also runs local models or AI plugins.
Practitioner guidance
- Restrict agent read access to the minimum needed Remove broad file, shell and service access from general-purpose assistants and grant only the resources required for the specific task.
- Sanitise context before the model sees it Filter configuration files, environment variables and prompt content so secrets are removed before they enter the agent’s working memory.
- Filter outputs before they leave the workflow Mask secrets in responses, logs and shared channels so a helpful answer cannot become a disclosure path.
Bottom line: AI agents leak secrets when access, memory and output channels are wider than the task actually requires.
Explore further
View Full Forum → | NHI Foundation Course → | Our Services → | Read the full analysis →