T09 · Insecure Skill Coding Practices
- Location
scripts/discogs.sh:31- Finding
Discogs API Token Exposed Through Process Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/discogs.sh:31-52
Vulnerability Type: Sensitive credential exposure through process arguments
Risk Level: MediumVulnerable Code
bash SEARCH_RESULT=$(curl -s -H "User-Agent: OpenclawSkill/1.0" -H "Authorization: Discogs token=${DISCOGS_TOKEN}" "$SEARCH_URL") PRICE_RESULT=$(curl -s -H "User-Agent: OpenclawSkill/1.0" -H "Authorization: Discogs token=${DISCOGS_TOKEN}" "$PRICE_URL") STATS_RESULT=$(curl -s -H "User-Agent: OpenclawSkill/1.0" -H "Authorization: Discogs token=${DISCOGS_TOKEN}" "$STATS_URL")Technical Analysis
The script expands
DISCOGS_TOKENdirectly into the command-line arguments supplied tocurl. While the authenticated requests are necessary for the declared Discogs lookup functionality, placing the token in the process argument vector is not necessary.Depending on the operating system's process-isolation configuration, command-line arguments may be observable through process inspection interfaces, monitoring agents, audit logs, debugging wrappers, or process-accounting systems. The token is exposed for the lifetime of each of the three
curlprocesses. Systems that restrict process visibility reduce the practical risk, but the implementation should not rely on that environmental protection.The static pre-scan also identified credential paths documented in
SKILL.md:20. The executable script does not read those paths and only consumesDISCOGS_TOKENfrom its environment, so no unauthorized credential-file access was confirmed. The documented file-based setup option is inconsistent with the implementation but does not itself create credential access beyond the Skill's requirements.Attack Path
- A victim invokes the Skill with a valid
DISCOGS_TOKEN. - The script launches an authenticated
curlrequest. - Shell expansion places the complete authorization header, including the token, in the
curlprocess argument v ...[truncated 800 chars]
- A victim invokes the Skill with a valid
- Remediation
View remediation
Remediation Suggestions
Avoid placing authentication material directly in
curlcommand-line arguments.- Provide the authorization header through a protected input mechanism, such as a temporary curl configuration or header file created with mode
0600. - Create temporary files only in a trusted directory using
mktemp, set a restrictiveumask, and register a trap that removes them on normal exit and interruption. - Launch
curlwithDISCOGS_TOKENremoved from its inherited environment after preparing the protected authentication input. - Prefer a credential helper or API client capable of keeping credentials out of both the process argument vector and inherited environment.
- Rotate any token suspected of having been exposed.
- Run the Skill under an account and execution environment that restrict process inspection and command telemetry.
A hardened implementation should also retain HTTPS certificate verification and ensure that authentication is sent only to the fixed
https://api.discogs.comorigin.- Provide the authorization header through a protected input mechanism, such as a temporary curl configuration or header file created with mode
