T09 · Insecure Skill Coding Practices
- Location
rankscale-skill.js:2154- Finding
Rankscale API Key Exposed in Error Output
- Content
View full analysis
Vulnerability Details
File Location:
rankscale-skill.js:2154-2157
Vulnerability Type: Sensitive credential exposure through stderr logging
Risk Level: MediumVulnerable Code
js console.error( ` RANKSCALE_API_KEY=${apiKey} ` + 'node rankscale-skill.js --discover-brands' );Technical Analysis
When a report request results in a
NotFoundError, the application constructs a troubleshooting command containing the complete Rankscale API key and writes it to stderr. API keys are bearer credentials and should never be included in diagnostic output.Stderr may be collected by OpenClaw gateways, CI systems, process supervisors, terminal recording systems, centralized logging services, or support bundles. Consequently, the credential can persist beyond the process lifetime and become accessible to users or services that are authorized to read logs but are not authorized to access the Rankscale account.
Sending the API key in the HTTPS
Authorizationheader to the declared Rankscale API is necessary for the Skill’s functionality. Reproducing that key in local diagnostic output is not necessary and exceeds the minimum disclosure required to perform brand discovery.Attack Path
- The Skill is configured with a valid
RANKSCALE_API_KEY. - An invalid, stale, or unauthorized brand ID is supplied through
--brand-idorRANKSCALE_BRAND_ID. - The request to the report endpoint returns HTTP 404, producing a
NotFoundError. - The error handler writes a suggested command containing the full API key to stderr.
- A gateway, CI runner, process supervisor, or logging platform captures the output.
- A party with access to those logs extracts the bearer credential.
- That party can submit authenticated Rankscale API requests within the permissions assigned to the exposed key.
Impact Assessment
Successful exploitation exposes the Rankscale bearer API key. The resulting privil ...[truncated 493 chars]
- The Skill is configured with a valid
- Remediation
View remediation
Remediation Suggestions
-
Remove the API key from all diagnostic and troubleshooting output:
js console.error( ' node rankscale-skill.js --discover-brands' ); -
Rely on the already configured environment variable rather than reproducing its value in a command.
-
Introduce a centralized redaction function for errors and logs. At minimum, redact values matching the Rankscale key format and any value equal to the resolved API key.
-
Review all exception paths to ensure request headers, command-line arguments, and environment variables cannot be included in logs.
-
Add regression tests that trigger the not-found path and assert that stdout, stderr, and thrown error messages do not contain the test API key.
-
Discourage
--api-keyfor normal use because command-line arguments may be visible in process listings and shell history. Prefer protected environment injection or an appropriate secret manager. -
Rotate any API key that may already have appeared in logs, then remove or restrict access to historical log records containing it.
-
