T09 · Insecure Skill Coding Practices
- Location
scripts/readdy.mjs:1428- Finding
API Key Exposure Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/readdy.mjs:1428-1457
Related Documentation:SKILL.md:27-33, 88
Vulnerability Type: Sensitive information exposure through process arguments
Risk Level: MediumVulnerable Code
js function configCommand(opts) { if (opts.apiKey) { saveApiKey(opts.apiKey); info(`apiKey saved → ${CREDENTIALS_FILE}`); } else { const key = loadApiKey(); if (key) { info(`apiKey: ${key.slice(0, 8)}*** ← ${CREDENTIALS_FILE}`); } else { die('API Key not configured. Run: node readdy.mjs config --apiKey <your-key>'); } } } function parseArgs(argv) { const args = argv.slice(2); const command = args[0]; const opts = {}; for (let i = 1; i < args.length; i++) { if (args[i].startsWith('--')) { const key = args[i].slice(2); const next = args[i + 1]; if (next && !next.startsWith('--')) { opts[key] = next; i++; } else { opts[key] = true; } } } return { command, opts }; }The documented invocation is:
bash node <SCRIPT> config --apiKey <your-key>Technical Analysis
The configuration interface requires the Readdy API key to be supplied as a command-line argument and retrieves it from
process.argv. Secrets passed this way may be:- Recorded in shell history.
- Visible in process listings while the command is running.
- Collected by process-monitoring, auditing, or telemetry software.
- Retained in terminal logs or automation execution records.
The key is subsequently saved to a credentials file with mode
0600, which appropriately restricts the stored file on supported systems. However, those permissions do not protect the secret during command invocation or remove copies retained by the shell or monitoring infrastructure.Sending the key to `https://readdy.ai/api ...[truncated 1552 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace command-line secret entry with hidden interactive input that disables terminal echo.
- Support reading the key from standard input or a dedicated file descriptor so it does not appear in
process.argv. - If automation support is required, accept a path to a protected credentials file rather than accepting the key value directly.
- Avoid recommending environment variables as the only alternative because they can also leak through diagnostics, child processes, and deployment metadata.
- Update
SKILL.md, usage output, and error messages to remove examples that place the key directly on the command line. - Warn existing users that keys configured through the current workflow may remain in shell history and recommend deleting relevant history entries and rotating exposed keys.
- Continue storing the credentials file with restrictive permissions, and explicitly apply or verify
0600after writes to protect pre-existing files consistently.
