T09 · Insecure Skill Coding Practices
Warning
- Location
- references/auth-setup.md:5
- Finding
- Insecure Persistent Storage of API Credentials## Vulnerability Details **File Location**: `references/auth-setup.md`, lines 5-10 and 26-30 **Vulnerability Type**: Plaintext persistent credential storage **Risk Level**: Medium ### Vulnerable Code ```markdown This guide gets you a StayingAPI key and persists it so it survives across sessions. ## Step 0 — how to store an env var on this system Figure out the correct way to persist an environment variable on this machine so it is available in every future session (a shell profile, or a config/env file managed by your agent runtime). The variable name is `STAYINGAPI_KEY`. ``` ```markdown ## Step 2 — store it ```bash export STAYINGAPI_KEY="stay_live_…" # or stay_test_… for the sandbox ``` ``` ### Technical Analysis The setup guide instructs the agent to make `STAYINGAPI_KEY` available across future sessions, potentially by writing it to a shell profile or runtime-managed environment file. Such files commonly store values in plaintext and may be exposed through permissive filesystem permissions, backups, diagnostic output, accidental source-control commits, or access by other local processes. The guide does not require a secret manager, owner-only permissions, repository exclusion, history and log protection, user approval before modifying persistent configuration, or credential rotation and revocation procedures. In addition, the displayed `export` command is only session-scoped by itself, creating ambiguity that may lead an agent to insert it into an unspecified persistent profile. This is not evidence of malicious credential exfiltration: the documented verification request sends the credential only to the declared StayingAPI origin. The vulnerability is the unsafe guidance for local credential persistence. ### Attack Path 1. A user or agent follows the setup guide and obtains a live StayingAPI key. 2. To satisfy the cross-session persistence instruction, the key is written in plaintext to a shell profile, environment file, or agent runtime confi ...[truncated 1111 chars]
- Remediation
- ## Remediation Suggestions 1. Prefer an operating-system keychain, runtime secret store, or dedicated secrets manager instead of shell profiles and general configuration files. 2. Prefer the documented OAuth 2.1 and PKCE MCP flow where supported so that a raw API key does not need to be pasted into or persistently managed by the agent. 3. Require explicit user approval before modifying any persistent shell profile or runtime configuration. 4. If file-based storage is unavoidable: - Use a dedicated file outside the project and source-control directories. - Restrict ownership to the intended user. - Set permissions to owner read/write only, such as `0600`. - Add the file to applicable source-control ignore rules. - Prevent the value from appearing in shell history, command traces, logs, diagnostics, and generated reports. 5. Document how to revoke and rotate a key after suspected exposure. 6. Clarify that `export STAYINGAPI_KEY=...` alone is temporary and avoid encouraging insertion of plaintext credentials into shared shell profiles. 7. Recommend using a sandbox key for evaluation and a separately scoped live key only when live access is required.
