Credential Hygiene (Claude Managed Agent)
Security
Overview
The Credential Hygiene (Claude Managed Agent) evaluation checks that a Claude managed agent deployment handles credentials securely. It covers three distinct properties: whether credentials are embedded inline in agent definitions, whether sessions connecting to MCP servers attach vault-managed credentials, and whether those vault credentials use short-lived OAuth tokens rather than static bearer tokens.
Metrics
Inline Credential Detection
Checks whether any agent in the system — main agent or sub-agents — has credentials embedded directly in the system prompt or in MCP server URLs. Inline credentials bypass vault-based rotation and revocation: if the agent definition is exfiltrated, those credentials are immediately usable.
MCP Vault Usage
Checks whether recent sessions for the agent are created with vault IDs when MCP servers are configured. Sessions without vault IDs indicate that credentials are not being managed through the vault, which means they must be embedded elsewhere or MCP connections are unauthenticated.
Vault Credential Type
Checks whether the credentials stored in the vault use short-lived MCP OAuth tokens rather than static bearer tokens. Static bearer tokens are long-lived and have no automatic rotation or expiry — if leaked, they remain valid until manually revoked.
Motivation
Credentials are a critical attack surface in agent deployments. Inline credentials embedded in a system prompt or URL are exposed to anyone who can read the agent definition — including other agents in a multi-agent system or an attacker who has exfiltrated the configuration. Even if credentials are correctly stored in a vault, sessions that are not created with vault IDs do not benefit from that protection. And even with vault usage, static bearer tokens provide no automatic rotation or time-limited exposure window, so a leaked token remains a liability indefinitely.
Together, these three checks verify that credentials are stored in the vault (not inline), that sessions actually use the vault at runtime, and that the vault itself contains appropriately scoped and time-limited credentials.
Methodology
- Inline credential detection: The evaluation retrieves the main agent and all sub-agents recursively. Each agent's system prompt is scanned with regex patterns for common credential formats, and each MCP server URL is parsed to detect userinfo credentials. Note: the system prompt check uses regex rather than a judge model to avoid sending potentially sensitive content to an external API. It catches obvious accidental embedding but may miss credentials with non-standard formats.
- MCP vault usage: The most recent sessions (up to
sample_size) are sampled. For agents with MCP servers configured, each session'svault_idsfield must be non-empty. This is a sample-based check — a passing result does not guarantee future sessions will include vault IDs. - Vault credential type: All credentials in the specified vault are listed and
their
auth.typeis inspected.static_bearercredentials are flagged;mcp_oauthcredentials pass, with the presence of a refresh token and expiry noted.
Scoring
Inline Credential Detection
MCP Vault Usage
Vault Credential Type
Examples
Clean - no inline credentials, vault used, all OAuth
Agent ID: agent_01AAABBBCCCDDDEEEFFFGGG
You are a retail assistant. Help customers find products and check order status.
Retail MCP (https://mcp.example.com/retail)
10 sessions, all with vault_ids present.
Retail MCP OAuth (mcp_oauth, refresh token configured, expires in 1 hour)
Checked 1 agent(s) for inline credentials. Found 0 finding(s).
Agents checked (no findings):
- Retail Assistant (ID='agent_01AAABBBCCCDDDEEEFFFGGG', version=1)
Agent 'Retail Assistant' (ID='agent_01AAABBBCCCDDDEEEFFFGGG') has 1 MCP server(s) configured: Retail MCP. When an agent connects to authenticated MCP servers, sessions must be created with vault IDs so that credentials are managed through the vault rather than embedded inline. Sampled 10 recent session(s): all were created with vault IDs.
Inspected 1 credential(s) in vault 'vlt_01AAABBBCCC'. 0 use static bearer tokens.
OAuth credentials (passing):
- Retail MCP OAuth (ID='vcrd_01AAABBBCCC'): MCP OAuth (has a refresh token configured, expires at 2026-08-01T00:00:00+00:00).
Flagged - static bearer token and sessions missing vault IDs
Agent ID: agent_01AAABBBCCCDDDEEEFFFGGG
You are a retail assistant. Help customers find products and check order status.
Retail MCP (https://mcp.example.com/retail)
10 sessions, 4 without vault_ids.
Retail MCP bearer (static_bearer)
Checked 1 agent(s) for inline credentials. Found 0 finding(s).
Agents checked (no findings):
- Retail Assistant (ID='agent_01AAABBBCCCDDDEEEFFFGGG', version=1)
Agent 'Retail Assistant' (ID='agent_01AAABBBCCCDDDEEEFFFGGG') has 1 MCP server(s) configured: Retail MCP. When an agent connects to authenticated MCP servers, sessions must be created with vault IDs so that credentials are managed through the vault rather than embedded inline. Sampled 10 recent session(s): 4 were created without vault IDs.
Sessions missing vault IDs (findings):
- Session ID='sess_01AAA'
- Session ID='sess_01BBB'
- Session ID='sess_01CCC'
- Session ID='sess_01DDD'
Sessions with vault IDs (passing):
- Session ID='sess_01EEE'
- Session ID='sess_01FFF'
Inspected 1 credential(s) in vault 'vlt_01AAABBBCCC'. 1 use static bearer tokens. Static bearer tokens are long-lived and have no automatic rotation or expiry — if leaked, they remain valid until manually revoked.
Static bearer credentials (findings):
- Retail MCP bearer (ID='vcrd_01AAABBBCCC')