T09 · Insecure Skill Coding Practices
- Location
references/ci-github-actions.yml:10- Finding
Workflow-level remote-cache credentials are exposed to unrelated CI steps
- Content
View full analysis
Vulnerability Details
File Location:
references/ci-github-actions.yml, lines 10-12
Vulnerability Type: Excessive secret scope and potential credential exfiltration
Risk Level: HighVulnerable code:
yaml env: TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} TURBO_TEAM: ${{ secrets.TURBO_TEAM }}Technical Analysis
TURBO_TOKENandTURBO_TEAMare declared in the workflow-levelenvblock. Consequently, GitHub Actions injects them into every process launched by every step in every job, rather than only into the Turbo build commands that require remote caching.The credentials are therefore available to:
- Package lifecycle scripts executed by
pnpm install --frozen-lockfile. - Repository-controlled lint, test, type-check, and build scripts.
- All third-party actions and subprocesses used by the workflow.
- The preview deployment job, even though its Vercel deployment operation does not inherently require the Turbo remote-cache credentials.
This exceeds minimum privilege. The declared functionality only requires the credentials while Turbo communicates with the configured remote-cache service. Supplying them to dependency installation and unrelated commands creates an unnecessary exfiltration path. A malicious dependency lifecycle script or malicious same-repository pull request could read the environment variables and transmit them over the network.
GitHub normally withholds repository secrets from pull requests originating from forks, which limits one common attack path. It does not protect against compromised dependencies, malicious changes from branches within the repository, compromised maintainer accounts, or untrusted commands running during push-triggered workflows.
Attack Path
- An attacker compromises a dependency, contributes a malicious package lifecycle script, or modifies a repository script that executes in CI.
- A workflow runs on
pushor on an eligible pull req ...[truncated 1141 chars]
- Package lifecycle scripts executed by
- Remediation
View remediation
Remediation Suggestions
- Remove the workflow-level
envdeclaration. - Inject the remote-cache credentials only into individual Turbo steps that need remote caching:
yaml - name: Build run: pnpm turbo build env: TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} TURBO_TEAM: ${{ secrets.TURBO_TEAM }} - Do not expose these variables to
pnpm install, linting, or other commands unless remote-cache access is demonstrably required. - Consider disabling remote cache for untrusted pull-request validation and enabling it only for trusted branches or post-merge workflows.
- Use separate credentials for read-only and cache-write operations where the remote-cache provider supports that distinction.
- Restrict the token to the specific team and repository and configure the shortest practical lifetime.
- Review package lifecycle scripts and consider
pnpm install --ignore-scriptswhere compatible, followed by explicit execution of only required installation scripts. - Add egress controls or monitoring to CI runners where practical, and rotate
TURBO_TOKENimmediately if exposure is suspected.
- Remove the workflow-level
