T09 · Insecure Skill Coding Practices
- Location
package.json:12- Finding
GitHub Personal Access Token Embedded in Repository URL
- Content
View full analysis
Vulnerability Details
File Location:
package.json:12-15
Vulnerability Type: Hardcoded authentication credential
Risk Level: HighVulnerable Code
json "repository": { "type": "git", "url": "git+https://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@github.com/simonstang/atomic-rag-knowledge-base.git" },Technical Analysis
The repository URL contains a GitHub personal access token in plaintext. Anyone who receives this package, reads its source, accesses a cached copy, or observes tooling logs containing the repository URL can recover the credential.
Embedding credentials in URLs also increases secondary exposure because Git clients, package managers, build systems, proxy logs, shell histories, and diagnostic output may record complete URLs. Whether exploitation remains possible depends on whether the token is still valid and which permissions and repository access were assigned to it.
Attack Path
- An attacker downloads or otherwise accesses the project.
- The attacker opens
package.jsonand extracts the token from the repository URL. - The attacker attempts to authenticate to the GitHub API or Git operations using the exposed token.
- If the token remains valid, the attacker enumerates the repositories and operations permitted by its scopes.
- The attacker reads private resources, modifies repository content, creates releases, or performs other operations allowed by the token.
- Modified repository content could subsequently be distributed to users who clone or install the project.
Impact Assessment
The exact impact cannot be established from the repository because the token's current validity and permission scopes are unknown. If valid, the attacker can obtain all GitHub privileges granted to the token. Depending on those privileges, the scope could include private repository access, source-code modification, issue management, release manipulation, or broader account and organization resources.
Repository ...[truncated 162 chars]
- Remediation
View remediation
Remediation Suggestions
- Revoke the exposed token immediately through GitHub's credential settings.
- Review the token's audit history and repository activity for unauthorized use.
- Replace the authenticated URL with a credential-free URL:
json "repository": { "type": "git", "url": "git+https://github.com/simonstang/atomic-rag-knowledge-base.git" }- Remove the secret from all Git history, tags, release archives, package publications, caches, and mirrors. Merely changing the current file does not remove historical exposure.
- Use a secret manager, CI secret store, environment variable, or Git credential helper when authenticated access is genuinely necessary.
- Grant replacement credentials only the minimum required permissions and use short expiration periods.
- Enable GitHub secret scanning and pre-commit secret detection to prevent recurrence.
