T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/submit_issue.py:11
- Finding
- Hardcoded GitHub Personal Access Token Exposed in Code and Documentation<![CDATA[ ## Vulnerability Details **File Location**: `scripts/submit_issue.py:11-17`; also exposed in `SKILL.md:76-83` and `references/quick-ref.md:17-42` **Vulnerability Type**: Hardcoded credential and plaintext secret exposure **Risk Level**: High ### Vulnerable Code ```python TOKEN = "ghp_[REDACTED_EXPOSED_TOKEN]" REPO = "openclaw/openclaw" BASE_URL = f"https://api.github.com/repos/{REPO}" HEADERS = { "Authorization": f"token {TOKEN}", "Accept": "application/vnd.github+json", "Content-Type": "application/vnd.github+json", } ``` The same plaintext token is repeated in `SKILL.md` and in multiple executable `curl` examples in `references/quick-ref.md`. The credential value is redacted in this report to avoid further disclosure. ## Technical Analysis A GitHub personal access token is embedded directly in executable Python code and distributed documentation. The script automatically includes the token in authenticated `POST`, `PATCH`, and `GET` requests to GitHub. Any party that can read the skill package can extract the credential without executing the script. Because the token is used to create and update issues, it has at least some authenticated repository or issue-management capability. Its complete scope cannot be determined from the audited files. Duplicating the token across three files increases the probability of accidental publication, log exposure, package redistribution, and incomplete remediation. ### Attack Path 1. An attacker obtains a copy of the skill package or reads any of the affected files. 2. The attacker extracts the plaintext GitHub token. 3. The attacker places the token in a GitHub API authorization header. 4. The attacker submits requests to GitHub using the token owner's identity. 5. The attacker performs any operation permitted by the token's configured scopes, including issue creation or modification where authorized. ### Impact Assessment The exposed credential can enable unauthorized authenticated GitHub A ...[truncated 608 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Revoke the exposed token immediately through GitHub. 2. Generate a replacement only if required, using the minimum necessary repository and operation scopes. 3. Remove the credential from: - `scripts/submit_issue.py` - `SKILL.md` - `references/quick-ref.md` - All version-control history, package archives, logs, and published artifacts 4. Load credentials from a protected environment variable or secret manager: ```python import os TOKEN = os.environ.get("GITHUB_TOKEN") if not TOKEN: raise RuntimeError("GITHUB_TOKEN is required") ``` 5. Do not include real credentials in documentation. Use placeholders such as `$GITHUB_TOKEN`. 6. Add automated secret scanning and pre-commit checks. 7. Review the exposed token's GitHub audit activity for unauthorized use. 8. Require explicit user approval before authenticated write operations. ]]>
