T09 · Insecure Skill Coding Practices
- Location
references/auth-setup.md:5- Finding
Persistent Storage of a Plaintext API Credential
- Content
View full analysis
Vulnerability Details
File Location:
references/auth-setup.md:5-9, 29-31(referenced bySKILL.md:27)
Vulnerability Type: Plaintext credential persistence and excessive credential exposure
Risk Level: MediumVulnerable Code Snippet
markdown ## 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 sandboxThe persistence procedure is invoked by the following instruction in
SKILL.md:27:markdown If `$STAYINGAPI_KEY` is not set, read [references/auth-setup.md](references/auth-setup.md) and follow it to get and store the key.Technical Analysis
The setup guide directs the agent to persist
STAYINGAPI_KEYin a shell profile or runtime-managed environment file so that it remains available in future sessions. It does not require use of an operating-system or runtime secret manager, restrictive file permissions, encryption at rest, limited process exposure, or explicit user approval before modifying persistent configuration.Environment variables exported from a shell profile can be inherited by unrelated child processes. A key stored in a plaintext profile or environment file may also be exposed through backups, diagnostic bundles, accidental repository commits, terminal or automation logs, and any local process or user that can read the relevant file. The example does not itself contain a real key, but it encourages users or agents to substitute and persist a live credential.
Attack Path
- The skill is invoked while
STAYINGAPI_KEYis unset. - The agent follows
SKILL.md:27and opens the authentication setup guide. - The user obtains a live StayingAPI key and the agent ...[truncated 1195 chars]
- The skill is invoked while
- Remediation
View remediation
Remediation Suggestions
- Store the credential in an operating-system keychain, secrets manager, or the agent runtime's protected secret facility instead of a shell profile.
- Prefer session-scoped credential injection when persistent access is unnecessary.
- Require explicit user confirmation before writing any credential to persistent storage.
- If a credential file is unavoidable, use a dedicated file outside the repository, restrict permissions to the owning user, and ensure it is excluded from version control, backups, logs, and diagnostic exports where practical.
- Avoid exposing the key to unrelated child processes; inject it only into the process that communicates with StayingAPI.
- Document procedures for key rotation and immediate revocation after suspected disclosure.
- Recommend sandbox keys for evaluation and live keys only when real data is required.
- Replace the generic persistence instruction with platform-specific, least-privilege guidance that verifies storage permissions without printing the credential.
