T09 · Insecure Skill Coding Practices
- Location
pettohumangenerator.js:13- Finding
API Token Exposed Through Command-Line Arguments
- Content
View full analysis
0) args.prompt = rest.join(' '); return args; } const { prompt: promptArg, size, token: tokenFlag, ref } = parseArgs(process.argv.slice(2)); const PROMPT = promptArg || DEFAULT_PROMPT; const TOKEN = tokenFlag; ``` The documented invocation explicitly places the secret in the command line: ```bash node pettohumangenerator.js "your description here" --token YOUR_TOKEN ``` ### Technical Analysis The API token is accepted exclusively through `process.argv`. Command-line arguments are not a secure secret-transport mechanism because they may be exposed through: - Shell history files. - Process inspection utilities and operating-system process metadata, subject to local access controls. - CI/CD command logs. - Terminal session recording and observability systems. - Wrapper scripts that record invoked commands. - Debugging or crash-reporting telemetry. Although the script does not print the token itself, exposure occurs before and during script execution because the token is part of the invocation command. The token is subsequently sent as the `x-token` header to the declared API endpoint, which is expected behavior; the vulnerability concerns local handling of that credential. ### Attack Path 1. A user follows the documentation and invokes the script with `--t ...[truncated 977 chars]- Remediation
View remediation
