T09 · Insecure Skill Coding Practices
- Location
evals/run_evals.py:6- Finding
API Key Exposure Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
evals/run_evals.py, lines 6–8
Vulnerability Type: Sensitive credential exposure through process arguments
Risk Level: MediumVulnerable Code
python python run_evals.py --api-key $ANTHROPIC_API_KEY python run_evals.py --scenario CRM-001 --api-key $ANTHROPIC_API_KEY python run_evals.py --verbose --api-key $ANTHROPIC_API_KEYTechnical Analysis
The usage documentation recommends supplying the Anthropic API key through the
--api-keycommand-line option. Before starting Python, the shell expands$ANTHROPIC_API_KEYinto its plaintext value. The resulting credential is placed in the new process's argument vector.Depending on the operating-system configuration, process arguments may be visible to other local users or captured by process-monitoring agents, diagnostic systems, audit logs, job schedulers, or shell-history tooling. Although the key is not hardcoded in the repository, the documented invocation creates an insecure credential-handling pattern.
Attack Path
- A user follows one of the documented commands.
- The shell expands
$ANTHROPIC_API_KEYto the plaintext credential. - The expanded key is included in the Python process's command-line arguments.
- A local user, monitoring service, process collector, or logging integration reads or records those arguments.
- The observer extracts the API key.
- The exposed key is reused to issue unauthorized API requests within the permissions and limits associated with that credential.
This path requires local process visibility or access to a system that records command-line arguments.
Impact Assessment
An attacker who obtains the key may:
- Make unauthorized Anthropic API requests.
- Consume the account's API quota or incur charges.
- Access API resources permitted to the compromised key.
- Disrupt evaluation activity by exhausting rate or spending limits.
This issue does not directly grant operating-system privileges. Its ...[truncated 66 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove examples that pass secrets through
--api-key. - Read
ANTHROPIC_API_KEYdirectly from the environment inside the evaluation framework without copying it intosys.argv. - If interactive credential entry is necessary, use protected standard input through Python's
getpass.getpass(). - Ensure logs and exception messages never print the credential or a complete invocation containing it.
- Redact sensitive command-line parameters in process-monitoring and CI/CD systems where command-line support must be retained for compatibility.
- Update the usage documentation to recommend a safer invocation:
bash export ANTHROPIC_API_KEY='...' python run_evals.py- Rotate any API key that may already have been exposed through process listings, logs, shell history, or monitoring systems.
- Remove examples that pass secrets through
