T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:19
- Finding
- Unsafe Collection and Handling of GitHub Access Tokens## Vulnerability Details **File Location**: `SKILL.md`, lines 19-26 **Vulnerability Type**: Sensitive credential exposure **Risk Level**: High **Vulnerable Code:** ```markdown GitHub CLI must be authenticated — PR creation, review monitoring, and commenting all require it: ```bash gh auth status # Must show "Logged in" ``` If not configured, ask the user to provide: 1. **GitHub username** — used for `--head {username}:{branch}` and PR search 2. **GitHub token** — run `gh auth login` or set `export GH_TOKEN=<token>` Token is required for: creating PRs, posting comments, checking review status, pushing iterations. ``` ### Technical Analysis The Skill explicitly instructs the agent to ask the user to provide a GitHub token. A personal access token is an authentication secret and should not be transmitted through an agent conversation. Tokens supplied through chat can be retained in conversation history, API request records, telemetry, debugging traces, or other logs. The suggested `export GH_TOKEN=<token>` pattern also encourages inserting a literal secret into shell input. Depending on how the command is executed, the token may be retained in shell history, terminal logs, process instrumentation, or agent tool-call records. The Skill does not require secure input, limit token permissions, recommend expiration, or prevent the agent from receiving the token directly. ### Attack Path 1. GitHub CLI is not authenticated when the Skill is invoked. 2. Following the Skill, the agent asks the user to provide a GitHub token. 3. The user enters the token into the conversation or a literal shell command. 4. The credential is retained in chat history, API logs, shell history, telemetry, or execution traces. 5. An attacker or unauthorized operator with access to one of those records extracts the token. 6. The attacker authenticates to GitHub and performs any operations permitted by the token's scopes until t ...[truncated 503 chars]
- Remediation
- ## Remediation Suggestions - Never ask users to disclose GitHub tokens to the agent or place tokens in conversation content. - Instruct users to authenticate independently using `gh auth login`, preferably through GitHub's browser or device authorization flow. - Use `gh auth status` only to verify that authentication has already been configured. - If non-interactive authentication is unavoidable, retrieve the credential from an approved secret manager without printing it or exposing it to the agent. - Use short-lived, repository-scoped, fine-grained tokens with only the permissions required for the specific operation. - Avoid literal secrets in shell commands. Disable shell history where appropriate and ensure diagnostic output cannot print authentication variables. - Document token rotation and immediate revocation procedures for suspected exposure. - Replace the affected instructions with wording such as: ```markdown If GitHub CLI is not authenticated, ask the user to run `gh auth login` independently. Never request, display, or store the user's access token. After authentication, verify the session with `gh auth status`. ```
