T09 · Insecure Skill Coding Practices
- Location
plushtoygenerator.js:22- Finding
API Token Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
plushtoygenerator.js:22-24, 36-45; documented usage inSKILL.md:15-19andREADME.md:61-67
Vulnerability Type: Sensitive credential exposure through process arguments
Risk Level: MediumVulnerable Code
javascript function parseArgs(args) { const out = { positional: [], size: 'square', token: null, ref: null }; for (let i = 0; i < args.length; i++) { const a = args[i]; if (a === '--size') { out.size = args[++i]; } else if (a === '--token') { out.token = args[++i]; } else if (a === '--ref') { out.ref = args[++i]; } else { out.positional.push(a); } } return out; }javascript const tokenFlag = args.token; const TOKEN = tokenFlag; if (!TOKEN) { console.error('\n✗ Token required. Pass via: --token YOUR_TOKEN'); console.error(' Get yours at: https://www.neta.art/open/'); exit(1); }The documented invocation reinforces this insecure credential-handling pattern:
bash node plushtoygenerator.js "your description here" --token YOUR_TOKENTechnical Analysis
The application requires the Neta API token to be passed as a command-line argument. Command-line arguments are not an appropriate secret transport mechanism because they can be retained in shell history, captured by command auditing or telemetry, and exposed through process-inspection facilities while the application is running.
The token is subsequently used as the
x-tokenauthentication header for requests tohttps://api.talesofai.com. Therefore, disclosure of the argument can reveal a reusable API credential rather than merely non-sensitive configuration data.Exploitation requires access to the user's shell history, local process information, command logs, or another system that records command invocations. The code does not intentionally print the token, and no remote credential exfiltration beyond transmission to ...[truncated 968 chars]
- Remediation
View remediation
Remediation Suggestions
- Prefer a protected environment variable, such as
NETA_API_TOKEN, rather than a command-line argument. - For interactive use, support reading the token from a non-echoing prompt or standard input.
- For automated deployments, integrate with an operating-system credential store or CI secret manager.
- Remove examples that place real secrets directly on the command line.
- If backward compatibility requires retaining
--token, mark it as deprecated and clearly warn that command-line values may be visible in process listings and shell history. - Ensure application errors, debug output, and telemetry never serialize request headers or the parsed token.
- Advise users who previously followed the documented pattern to remove affected shell-history entries and rotate potentially exposed tokens.
- Prefer a protected environment variable, such as
