T09 · Insecure Skill Coding Practices
- Location
scripts/lib/print-key.mjs:13- Finding
Arbitrary Environment Variable Disclosure Through Deprecated Key Printer
- Content
View full analysis
"); console.error("DEPRECATED: prefer scripts that call resolveKey() in-process."); process.exit(2); } const r = resolveKey(name); if (!r.value) { console.error(`Missing ${r.name}`); process.exit(1); } process.stdout.write(r.value); ``` The called resolver accepts the supplied name and checks the corresponding process environment variable: ```js export function resolveKey(name) { const canonical = ALIASES[name] || name; // 1) process.env canonical if (nonEmpty(process.env[canonical])) { return { name: canonical, value: process.env[canonical], source: "process.env" }; } ``` ### Technical Analysis Although the utility is marked deprecated, it remains executable and is distributed with the Skill. The user-controlled environment-variable name is not restricted to the research credential allowlist. Consequently, `resolveKey()` can return any non-empty variable inherited by the Node.js process, and `print-key.mjs` writes that value verbatim to standard output. The allowlist applied when reading credential files does not protect secrets already present in `process.env`. ### Attack Path 1. The agent or an attacker-influenced workflow requests a variable outside the research credential set. 2. It invokes, for example: ```bash node scripts/lib/print-key.mjs AWS_SECRET_ACCESS_KEY ``` 3. `resolveKey()` reads `process.env.AWS_SECRET_ACCESS_KEY`. 4. The utility emits the secret without masking. 5. The value may be captured in an agent transcript, shell history, CI log, or tool output. ### Impact Assessment Any environment variable available to the Skill process can be disclosed, including cloud c ...[truncated 221 chars]- Remediation
View remediation
