T09 · Insecure Skill Coding Practices
- Location
SKILL.md:45- Finding
GitHub Personal Access Token Stored in a Plaintext Shell Profile
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:45-49andREADME.md:41-46
Vulnerability Type: Plaintext credential storage
Risk Level: MediumVulnerable Code
bash echo 'export GITHUB_TOKEN=ghp_yourTokenHere' >> ~/.zshrc source ~/.zshrcThe project recommends permanently storing a GitHub Personal Access Token in a shell startup file. A PAT is a bearer credential, so anyone who obtains its value can exercise the permissions granted to it without possessing an additional secret.
Shell profiles are plaintext files and may be exposed through dotfile repositories, workstation backups, support bundles, home-directory read access, accidental file sharing, or overly broad filesystem permissions. Exporting the token also places it in the environment inherited by child processes, increasing the number of processes that may access it.
Technical Analysis
The recommended token only needs the GitHub
gistscope, which limits but does not eliminate the consequences of disclosure. A stolen token with that scope can generally be used to create gists under the victim's identity and access, modify, or delete gists authorized by the token. Private or secret gist contents accessible through the credential may consequently be disclosed.The sample placeholder is not itself a live hardcoded secret. The vulnerability is the documented practice of replacing that placeholder with a real credential and persisting it unencrypted.
Attack Path
- A user replaces
ghp_yourTokenHerewith a valid GitHub PAT and appends the export statement to~/.zshrc. - The profile is copied into a dotfile repository, included in a backup or diagnostic archive, or read by another account or process with home-directory access.
- An attacker extracts the PAT from the plaintext export statement.
- The attacker supplies the token to GitHub CLI or the GitHub API.
- The attacker performs operations permitted by the token's `gis ...[truncated 641 chars]
- A user replaces
- Remediation
View remediation
Remediation Suggestions
- Remove the recommendation to append a real PAT to
~/.zshrc,~/.bashrc, or another plaintext profile. - Prefer
gh auth login, allowing GitHub CLI to use the operating system's supported credential storage. - Where available, use a platform credential manager or dedicated secret manager.
- If an environment variable is necessary, set it only for the immediate process or session and unset it after use.
- Retain the least-privilege requirement that the token have only the
gistscope. - Recommend expiration dates and periodic token rotation.
- Warn users not to commit, synchronize, log, or include token-bearing files in support archives.
- Advise users who have already stored a token in a profile to remove it, revoke or rotate it, inspect dotfile history and backups, and review GitHub activity.
- Remove the recommendation to append a real PAT to
