T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/collect-sources.sh:43
- Finding
- Credential Exposure Through Unredacted Git Remote Output## Vulnerability Details **File Location**: `scripts/collect-sources.sh:43` **Vulnerability Type**: Sensitive information disclosure **Risk Level**: Medium **Vulnerable Code**: ```bash echo "remote: $(git remote get-url origin 2>/dev/null || echo none)" ``` ### Technical Analysis The source-collection script prints the complete Git origin URL without sanitization. Git permits credentials to be embedded in HTTPS remote URLs, including usernames, passwords, personal access tokens, and deployment credentials. Consequently, invoking the script against a repository whose origin contains credentials places those credentials in standard output. This contradicts the secret-redaction requirement in `SKILL.md:42`. Because the output is intended for use as audit evidence, it may subsequently enter agent context, execution logs, reports, Draft SPEC files, or GitHub Issues. The script does not deliberately transmit the remote URL to an external service. Exposure occurs through plaintext output and any downstream system that records or publishes that output. ### Attack Path 1. A repository is configured with a credential-bearing origin, such as an HTTPS URL containing a personal access token. 2. The Skill runs `scripts/collect-sources.sh` against that repository. 3. `git remote get-url origin` returns the complete credential-bearing URL. 4. Line 43 writes the unredacted URL to standard output. 5. The calling agent, CI system, terminal logger, or audit pipeline records the output. 6. If the inventory output is copied into a report, specification, issue, or other shared artifact, an unauthorized reader can recover and use the exposed credential. ### Impact Assessment The immediate scope is disclosure of credentials embedded in the repository's origin URL. The privileges obtainable depend on the exposed credential and may include reading or modifying private repositories, creating Issues or pull requests, pushing code, or access ...[truncated 283 chars]
- Remediation
- ## Remediation Suggestions - Do not print the raw value returned by `git remote get-url`. - Parse the URL and remove all user-information components before output. - Redact passwords, access tokens, and sensitive query parameters using a strict allowlist rather than attempting to identify only known token formats. - Prefer outputting normalized, non-sensitive metadata such as the remote host and repository path. - Where available, use `gh repo view --json nameWithOwner` to obtain repository identity without exposing remote credentials. - Add tests covering HTTPS URLs with usernames, passwords, tokens, query strings, SSH remotes, and malformed URLs. - Ensure downstream reports and logs also apply secret scanning and redaction as defense in depth.
