T09 · Insecure Skill Coding Practices
- Location
SKILL.md:44- Finding
API Key Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:44andbin/run.mjs:3549-3564
Vulnerability Type: API credential exposure through process arguments
Risk Level: MediumVulnerable Code
bash node {baseDir}/bin/run.mjs --operation "<operation-id>" --api-key "$JUST_SERP_API_KEY" --params-json '{"key":"value"}'js function parseArgs(argv) { const parsed = { apiKey: null, operation: null, paramsJson: "{}" }; for (let index = 0; index < argv.length; index += 1) { const flag = argv[index]; const value = argv[index + 1]; // Other argument handlers omitted. if (flag === "--api-key") { parsed.apiKey = value; index += 1; continue; } fail(`Unknown argument "${flag}".`); } return parsed; }The credential is then used for the intended authenticated API request:
js const requestInit = { headers: { "accept": "application/json", "X-API-Key": args.apiKey, }, method: operation.method, };Technical Analysis
The documented invocation expands
JUST_SERP_API_KEYinto the Node process command line. On systems where process arguments are visible to other users, administrators, monitoring agents, job runners, audit systems, or diagnostic tooling, the expanded secret may be captured while the process is running or retained in telemetry.The subsequent transmission of the key in the
X-API-Keyheader to the fixed HTTPS endpointhttps://api.justserpapi.comis necessary for the declared functionality and is not evidence of covert exfiltration. The weakness is specifically the local transport of the key throughargvbefore that request occurs.Attack Path
- A user invokes the Skill using the command documented in
SKILL.md. - The shell expands
$JUST_SERP_API_KEYand places its value in the Node process argument vector. - A local user or monitoring component with permission to inspect process metadata reads or records the command line.
- The observer ...[truncated 839 chars]
- A user invokes the Skill using the command documented in
- Remediation
View remediation
Remediation Suggestions
- Remove the
--api-keycommand-line option and readJUST_SERP_API_KEYdirectly fromprocess.env:
js const apiKey = process.env.JUST_SERP_API_KEY; if (!apiKey) { fail("Missing required JUST_SERP_API_KEY environment variable."); }- Update the documented command so the secret is not expanded into the argument vector:
bash node {baseDir}/bin/run.mjs \ --operation "<operation-id>" \ --params-json '{"key":"value"}'-
If direct environment access is unsuitable, accept the secret through standard input or a dedicated credential provider rather than through command-line arguments.
-
Ensure errors and diagnostics never print request headers, the environment variable, or the complete request configuration.
-
Redact command-line arguments and secrets in process telemetry, CI logs, shell tracing, and monitoring systems where possible.
-
Rotate any API key that may previously have been exposed through process listings or retained command-line telemetry.
- Remove the
