T09 · Insecure Skill Coding Practices
- Location
publish.py:10- Finding
Hard-Coded ClawHub Bearer Token
- Content
View full analysis
Vulnerability Details
File Location:
publish.py, lines 10 and 17-20, with additional use at lines 69-72
Vulnerability Type: Hard-coded authentication credential
Risk Level: HighVulnerable Code
python TOKEN = "clh_[REDACTED]" resp = requests.post( "https://clawhub.ai/api/cli/upload-url", headers={"Authorization": f"Bearer {TOKEN}"}, json={"filename": filename, "contentType": content_type} )The same credential is used in the primary publication request:
python resp = requests.post( API_URL, headers={"Authorization": f"Bearer {TOKEN}"}, data={"payload": json.dumps(payload)}, files=file_data )The token value is redacted from this report, but it is stored in plaintext in the audited source.
Technical Analysis
An authentication bearer token is embedded directly in the distributed Python source. Anyone with access to the Skill package can extract and reuse it independently of this program. Bearer tokens confer authority based solely on possession, so no additional proof of identity is needed.
The token is sent to ClawHub through HTTPS, which protects it in transit under normal certificate validation. However, transport encryption does not mitigate disclosure from source control, downloaded packages, logs, backups, or package mirrors.
This credential is also inconsistent with
filter_tag.json, which states that the project does not include or require an API key. The metadata can therefore prevent users or reviewers from recognizing the authentication risk.Attack Path
- An attacker downloads the Skill package or obtains a copy of its source.
- The attacker reads
publish.pyand extracts the plaintext token. - The attacker places the token in an
Authorization: Bearerheader. - The attacker directly invokes supported ClawHub API endpoints.
- The requests execute with the permissions assigned to the exposed token unt ...[truncated 535 chars]
- Remediation
View remediation
Remediation Suggestions
- Revoke the exposed token immediately and issue a replacement only after the source has been cleaned.
- Remove the credential from the current package and repository history, including tags, releases, caches, and published archives where feasible.
- Obtain a user-specific token from a protected environment variable or operating-system credential store:
python TOKEN = os.environ.get("CLAWHUB_TOKEN") if not TOKEN: raise RuntimeError("CLAWHUB_TOKEN is required") - Never provide a shared default credential or print the token in errors and logs.
- Grant the replacement token only the minimum publication permissions required.
- Add secret scanning to development and release workflows.
- Correct the project metadata and documentation to disclose the authentication requirement.
