T09 · Insecure Skill Coding Practices
- Location
animecharactergenerator.js:3- Finding
API Token Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
animecharactergenerator.js:3-21, 42-46; documented usage inSKILL.md:13-23andREADME.md:20-49
Vulnerability Type: Sensitive credential exposure through process arguments
Risk Level: MediumVulnerable Code
javascript const args = process.argv.slice(2); // Parse CLI arguments let prompt = null; let size = 'portrait'; let tokenFlag = null; let refUuid = null; for (let i = 0; i < args.length; i++) { if (args[i] === '--token' && args[i + 1]) { tokenFlag = args[++i]; } else if (args[i] === '--size' && args[i + 1]) { size = args[++i]; } else if (args[i] === '--ref' && args[i + 1]) { refUuid = args[++i]; } else if (!args[i].startsWith('--') && prompt === null) { prompt = args[i]; } } const TOKEN = tokenFlag;javascript const headers = { 'x-token': TOKEN, 'x-platform': 'nieta-app/web', 'content-type': 'application/json', };The documented invocation reinforces this insecure credential-handling pattern:
bash node animecharactergenerator.js "your prompt" --token YOUR_TOKENTechnical Analysis
The application requires the Neta API token to be supplied through the
--tokencommand-line argument. Command-line arguments are not an appropriate secret transport mechanism because they may be exposed through:- Process inspection facilities such as
ps,/proc/<pid>/cmdline, or system monitoring tools. - Shell command history when a literal token is entered.
- Process execution telemetry, audit logs, CI logs, or wrapper scripts.
- Diagnostic tools that record complete command lines.
The token is subsequently placed in the
x-tokenHTTP header and sent to the documented API endpoint. Transmission over HTTPS is expected behavior and is not itself the vulnerability; the weakness is exposing the token locally before the request i ...[truncated 1033 chars]- Process inspection facilities such as
- Remediation
View remediation
Remediation Suggestions
-
Read the token from a protected environment variable such as
NETA_TOKENinstead of accepting it through--token. -
For interactive use, support hidden input from a terminal or standard input without echoing the token.
-
If backward compatibility requires retaining
--token, mark it as deprecated and clearly warn that it can expose credentials. -
Update all examples to use a protected environment variable:
bash read -rsp "Neta API token: " NETA_TOKEN export NETA_TOKEN node animecharactergenerator.js "your prompt" unset NETA_TOKEN -
Ensure application errors never print request headers or token values.
-
Recommend short-lived, narrowly scoped tokens where the provider supports them.
-
Document token rotation and immediate revocation procedures for suspected exposure.
-
