T09 · Insecure Skill Coding Practices
- Location
pixarportraitgenerator.js:14- Finding
API Token Exposure Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
pixarportraitgenerator.js:14-37
Additional Locations:SKILL.md:17-21, 27-29;README.md:18-32, 55-67
Vulnerability Type: Sensitive credential exposure through process arguments and shell history
Risk Level: MediumVulnerable Code
javascript function parseArgs(argv) { const args = { positional: [], size: "square", token: null, ref: null }; for (let i = 0; i < argv.length; i++) { const a = argv[i]; if (a === "--size") args.size = argv[++i]; else if (a === "--token") args.token = argv[++i]; else if (a === "--ref") args.ref = argv[++i]; else args.positional.push(a); } return args; } async function main() { const argv = process.argv.slice(2); const { positional, size, token: tokenFlag, ref } = parseArgs(argv); const PROMPT = positional[0] || DEFAULT_PROMPT; 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/'); process.exit(1); }The documented invocation reinforces this practice:
bash node pixarportraitgenerator.js "your description here" --token YOUR_TOKENTechnical Analysis
The application exclusively accepts the Neta API token through the
--tokencommand-line option. Command-line arguments are not an appropriate secret transport mechanism because they can be exposed through:- Shell history files.
- Process inspection tools while the process is running.
- Process accounting and endpoint monitoring systems.
- CI/CD job output or command tracing.
- Wrapper scripts and automation logs.
The token is subsequently transmitted over HTTPS to the declared Neta API endpoint. The remote transmission itself is consistent with the documented image-generation functionality; the weakness is the local mechanism used to provide the credentia ...[truncated 1082 chars]
- Remediation
View remediation
Remediation Suggestions
-
Support a protected environment variable, such as
NETA_TOKEN, instead of requiring the token on the command line:javascript const TOKEN = process.env.NETA_TOKEN; -
For interactive use, optionally read the token from a hidden stdin prompt so it is not echoed or recorded in shell history.
-
If backward compatibility requires retaining
--token, mark it as deprecated and emit a warning explaining the exposure risk. -
Update all documentation to recommend protected environment-variable or stdin-based input:
bash export NETA_TOKEN="..." node pixarportraitgenerator.js "your description" -
Ensure error messages, diagnostic output, and exception handlers never include request headers or the token.
-
Advise users who previously supplied tokens on the command line to clear affected histories and logs and rotate potentially exposed credentials.
-
