T09 · Insecure Skill Coding Practices
- Location
SKILL.md:41- Finding
API Key Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:41; supporting implementation inbin/run.mjs:129-131andbin/run.mjs:156-158
Vulnerability Type: API credential exposure through the process argument vector
Risk Level: MediumVulnerable Code
SKILL.md:41:bash node {baseDir}/bin/run.mjs --operation "<operation-id>" --api-key "$JUST_SERP_API_KEY" --params-json '{"key":"value"}'bin/run.mjs:129-131:js if (!args.apiKey) { fail("Missing required --api-key argument."); }bin/run.mjs:156-158:js const requestInit = { headers: { "accept": "application/json", "X-API-Key": args.apiKey, }, method: operation.method, };The argument parser also explicitly accepts the credential through
--api-key:js if (flag === "--api-key") { parsed.apiKey = value; index += 1; continue; }Technical Analysis
The documented command expands
JUST_SERP_API_KEYinto the child process argument vector. Command-line arguments may be accessible to other local users or administrative monitoring components through process inspection interfaces, audit records, endpoint telemetry, shell tracing, diagnostic tooling, or process listings.Authentication to the declared Just Serp API is necessary for the Skill's functionality, and transmitting the key in an
X-API-Keyheader over the hard-coded HTTPS endpoint is consistent with that purpose. However, passing the credential through a command-line argument is not necessary and exceeds the minimum exposure required. The script can readprocess.env.JUST_SERP_API_KEYdirectly without placing the secret in its argument vector.No evidence was found that the script deliberately prints the API key or transmits it to an undeclared host. The vulnerability is the avoidable local exposure created before the authenticated HTTPS request is made.
Attack Path
- A victim configures `JUST ...[truncated 1184 chars]
- Remediation
View remediation
Remediation Suggestions
-
Remove the
--api-keycommand-line option from both the documentation and argument parser. -
Read the credential directly from the process environment:
js const apiKey = process.env.JUST_SERP_API_KEY; if (!apiKey) { fail("Missing required JUST_SERP_API_KEY environment variable."); } -
Construct the authentication header using the environment-derived value:
js const requestInit = { headers: { accept: "application/json", "X-API-Key": apiKey, }, method: operation.method, }; -
Update the documented invocation so the secret is not expanded into an argument:
bash node {baseDir}/bin/run.mjs --operation "<operation-id>" --params-json '{"key":"value"}' -
As an alternative where environment variables are unsuitable, accept the secret through protected standard input or an operating-system credential store.
-
Keep the key out of error payloads, logs, debug traces, telemetry, and shell tracing.
-
Rotate any API key that may previously have been captured in process telemetry or audit logs.
-
