credential_hygiene_claude_managed_agent

Credential Hygiene (Claude Managed Agent)

Checks that a Claude managed agent deployment avoids inline credential embedding, uses vault-managed credentials for MCP connections, and prefers short-lived OAuth tokens over static bearer tokens.
Tags:

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.

Inline Credential Detection
0.01.0
0.0
1.0
0.0One or more agents have credentials embedded inline in the system prompt or MCP server URLs.
1.0No inline credentials detected in any agent's system prompt or MCP server URLs.

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.

MCP Vault Usage
0.01.0
0.0
1.0
0.0One or more sampled sessions were created without vault IDs despite MCP servers being configured.
1.0All sampled sessions were created with vault IDs (or no MCP servers are configured).

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.

Vault Credential Type
0.01.0
0.0
1.0
0.0One or more vault credentials use a static bearer token with no automatic rotation or expiry.
1.0All vault credentials use MCP OAuth (or the vault is empty).

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

  1. 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.
  2. MCP vault usage: The most recent sessions (up to sample_size) are sampled. For agents with MCP servers configured, each session's vault_ids field must be non-empty. This is a sample-based check — a passing result does not guarantee future sessions will include vault IDs.
  3. Vault credential type: All credentials in the specified vault are listed and their auth.type is inspected. static_bearer credentials are flagged; mcp_oauth credentials pass, with the presence of a refresh token and expiry noted.

Scoring

Inline Credential Detection

Inline Credential Detection
Score valueExplanation
1No inline credentials detected in any agent's system prompt or MCP server URLs.
0One or more agents have credentials embedded inline in the system prompt or MCP server URLs.

MCP Vault Usage

MCP Vault Usage
Score valueExplanation
1All sampled sessions were created with vault IDs (or no MCP servers are configured).
0One or more sampled sessions were created without vault IDs despite MCP servers being configured.

Vault Credential Type

Vault Credential Type
Score valueExplanation
1All vault credentials use MCP OAuth (or the vault is empty).
0One or more vault credentials use a static bearer token with no automatic rotation or expiry.

Examples

Clean - no inline credentials, vault used, all OAuth

Agent

Agent ID: agent_01AAABBBCCCDDDEEEFFFGGG

System prompt (excerpt)

You are a retail assistant. Help customers find products and check order status.

MCP servers
Sessions sampled

10 sessions, all with vault_ids present.

Vault credentials

Retail MCP OAuth (mcp_oauth, refresh token configured, expires in 1 hour)

Inline Credential Detection
1.0

Checked 1 agent(s) for inline credentials. Found 0 finding(s).

Agents checked (no findings):

  • Retail Assistant (ID='agent_01AAABBBCCCDDDEEEFFFGGG', version=1)
MCP Vault Usage
1.0

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.

Vault Credential Type
1.0

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

Agent ID: agent_01AAABBBCCCDDDEEEFFFGGG

System prompt (excerpt)

You are a retail assistant. Help customers find products and check order status.

MCP servers
Sessions sampled

10 sessions, 4 without vault_ids.

Vault credentials

Retail MCP bearer (static_bearer)

Inline Credential Detection
1.0

Checked 1 agent(s) for inline credentials. Found 0 finding(s).

Agents checked (no findings):

  • Retail Assistant (ID='agent_01AAABBBCCCDDDEEEFFFGGG', version=1)
MCP Vault Usage
0.0

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'
Vault Credential Type
0.0

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')

Run Evaluation in LatticeFlow AI Platform

Use the following CLI command to initialize and run the evaluation in LatticeFlow AI Platform.
Requires LatticeFlow AI Platform CLI
lf init --atlas credential_hygiene_claude_managed_agent

Metrics

Inline Credential Detection

MCP Vault Usage

Vault Credential Type

Don't have the LatticeFlow AI Platform?

Contact us to see this evaluation in action:
Contact Us