T09 · Insecure Skill Coding Practices
Note
- Location
- references/auth-setup.md:5
- Finding
- Persistent Plaintext Storage of StayingAPI Credentials## Vulnerability Details **File Location**: `references/auth-setup.md`, lines 5-8 and 28-30 **Vulnerability Type**: Persistent plaintext secret exposure **Risk Level**: Low **Relevant Code Snippet**: ```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`. ``` ```bash export STAYINGAPI_KEY="stay_live_…" # or stay_test_… for the sandbox ``` ### Technical Analysis The authentication guide directs users to persist the API credential in a shell profile or configuration/environment file and demonstrates exporting the credential as an environment variable. Shell profiles and ordinary environment files commonly store values in plaintext. The guide does not require restrictive file permissions, recommend an operating-system keychain or secret manager, or limit credential injection to the process that needs it. When placed in a global shell profile, `STAYINGAPI_KEY` may be inherited by every descendant process launched from future shell sessions. Local programs, plugins, build scripts, diagnostic tools, crash handlers, or compromised processes operating under the same user account could inspect the inherited environment. If the profile or environment file has overly broad permissions, another local account may also be able to read the credential directly. ### Attack Path 1. The user follows the guide and adds `export STAYINGAPI_KEY="stay_live_…"` to a persistent shell profile or plaintext environment file. 2. The credential is automatically loaded into future sessions and inherited by child processes, or remains directly readable from the storage file. 3. A malicious or compromised process running in the u ...[truncated 1140 chars]
- Remediation
- ## Remediation Suggestions 1. Prefer an operating-system keychain, dedicated secret manager, or the Agent runtime's protected credential store instead of a shell profile. 2. Inject `STAYINGAPI_KEY` only into the process that requires it rather than exporting it globally to all future sessions and child processes. 3. If file-based storage is unavoidable, use a dedicated file outside the repository, restrict it to the owning user with permissions such as `0600`, and ensure it is excluded from source control, logs, backups, and diagnostic bundles where appropriate. 4. Avoid displaying the credential in shell history, command traces, logs, error messages, or process arguments. 5. Document how users can revoke and rotate a potentially exposed key through the StayingAPI dashboard. 6. Clearly distinguish sandbox credentials from live credentials and recommend sandbox keys for development and testing. 7. Add guidance for periodically reviewing and rotating live credentials and for immediately revoking them after suspected disclosure.
