T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:190
- Finding
- Private repository credential remains accessible to deployed application code<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 190-197 **Vulnerability Type**: Repository credential exposure to untrusted build and application code **Risk Level**: High ### Vulnerable Code Snippet ```markdown Send `repoToken` with a token that can read the repository. It is encrypted at rest, handed to the pod at deploy time, and never returned. `repoUser` you can leave out. Forges disagree about what goes next to a token — GitHub takes `x-access-token`, GitLab `oauth2`, Bitbucket `x-token-auth`, Gitea and Forgejo the token alone — and a self-hosted GitLab is indistinguishable from a self-hosted Gitea by its URL. The pod tries the forms in turn and keeps the one the server accepts; the build log names it. Send `repoUser` only to skip that. Know what you are agreeing to: the token lives in the pod's environment, and the code you deploy runs in that pod. It is your own repository token, but anything you deploy can read it. Use a token scoped to that one repository. ``` ### Technical Analysis A private-repository token is legitimately required during repository checkout. However, the documented design places the token in the pod environment where deployed code can read it. Retaining the credential after checkout exceeds the minimum privileges required for the application's build and runtime phases. Encryption at rest and suppressing the token from API responses do not protect it after injection into the pod. Application code, build scripts, lifecycle hooks, compromised dependencies, or command execution vulnerabilities may inspect the process environment and disclose the credential. The guidance to scope the token to one repository reduces the potential impact but does not eliminate the underlying exposure. ### Attack Path 1. An operator supplies a valid private-repository token through `repoToken`. 2. The platform injects that token into the deployment pod. 3. A malicious repository script, compromised dependency, build hook, o ...[truncated 883 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Perform repository checkout in a dedicated, isolated stage using an ephemeral clone-only credential. 2. Remove the credential from all environment variables, Git credential helpers, remote URLs, configuration files, and process state before running repository-controlled build commands. 3. Do not expose repository credentials to the deployed application's runtime environment. 4. Use short-lived, read-only credentials restricted to a single repository and, where supported, a single branch. 5. Separate source acquisition from builds so that build scripts and dependencies cannot access checkout credentials. 6. Redact raw, URL-encoded, and alternate representations of credentials from logs. 7. Add automated tests verifying that build and runtime processes cannot retrieve `repoToken`. 8. Document immediate revocation and rotation procedures for suspected credential disclosure. ]]>
