T09 · Insecure Skill Coding Practices
- Location
scripts/subtitle_translate.py:36- Finding
Hard-Coded QClaw Bearer Token in Source Code
- Content
View full analysis
Vulnerability Details
File Location:
scripts/subtitle_translate.py:36
Vulnerability Type: Hard-coded authentication credential
Risk Level: MediumVulnerable Code
python QCLAW_TOKEN = "78238b99f7ed3fb71de138d875005ac5a80274920af729fe"The credential is subsequently added to the authorization header:
python req = urllib.request.Request( QCLAW_GATEWAY, data=payload, headers={ 'Authorization': f'Bearer {QCLAW_TOKEN}', 'Content-Type': 'application/json' } )Technical Analysis
A bearer token is embedded directly in the executable source code. Any person or process that can read the Skill package can recover this credential without needing elevated privileges.
Bearer tokens generally grant access based solely on possession. If the token remains active and is accepted by an accessible QClaw deployment, an attacker can replay it without knowing any additional secret. Although the default gateway address is localhost, this does not eliminate the exposure: the same token may be accepted by another deployment, the local gateway may be exposed through forwarding or configuration changes, or the source code may be copied to another environment.
Embedding credentials in source also causes them to persist in archives, package distributions, backups, and source-control history after the visible value is changed.
Attack Path
- An attacker obtains read access to the Skill package, an archive, a backup, or a repository containing the script.
- The attacker reads
QCLAW_TOKENfromscripts/subtitle_translate.py. - The attacker identifies a reachable QClaw-compatible gateway that accepts the token, including a locally exposed, forwarded, or separately deployed endpoint.
- The attacker submits requests with
Authorization: Bearer <token>. - If the credential remains valid, the gateway treats the attacker as the token holder.
Expl ...[truncated 730 chars]
- Remediation
View remediation
Remediation Suggestions
- Revoke and rotate the exposed token immediately.
- Remove the token from the source code and all distributed copies.
- Load the replacement credential from an environment variable, operating-system credential store, or dedicated secret manager.
- Refuse to start translation when the credential is absent rather than supplying a working default.
- Ensure logs and exception messages never print authorization headers or token values.
- Grant the replacement token only the minimum API permissions and quota required.
- If the project is version-controlled, purge the credential from repository history while treating it as compromised regardless of history rewriting.
- Add automated secret scanning to packaging and continuous-integration workflows.
