Summary
The Skim project's generate-files GitHub Actions workflow executed attacker-controlled fork code via cargo run while exposing sensitive secrets such as SKIM_RS_BOT_PRIVATE_KEY and a GITHUB_TOKEN with write access.
Any GitHub user able to open a pull request from a fork could abuse this workflow to run arbitrary code in the CI environment and misuse the exposed credentials.
Affected context
This vulnerability appears in the Skim repository's GitHub Actions configuration, specifically the generate-files job defined in .github/workflows/pr.yml.
The workflow checks out code from pull requests originating from forks and then runs cargo run, effectively delegating execution control to the fork's code.
At the same time, the job exposes powerful secrets (SKIM_RS_BOT_PRIVATE_KEY and a GITHUB_TOKEN with contents:write), creating a high-risk intersection of untrusted code and privileged credentials.
Exploit preconditions
- Attack surface: GitHub Actions CI pipeline for pull requests
- Required access: Ability to create a fork of the Skim repository and open a pull request (available to any GitHub user)
- Trigger point: Opening a PR from a fork that modifies the code path executed by
cargo runin thegenerate-filesjob - Why exploitation is possible:
- The workflow runs
cargo runon untrusted fork code during PR CI - The same job exposes sensitive secrets (
SKIM_RS_BOT_PRIVATE_KEY,GITHUB_TOKENwithcontents:write) - No conditional gates or trust checks restrict secret exposure for fork-based pull requests
Why this happens
The underlying issue is a CI configuration pattern where untrusted, contributor-supplied code is executed with access to highly privileged secrets.
This maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), because the workflow effectively lets external parties define the code that runs in a privileged context.
Rather than treating forked pull request code as untrusted and isolating it from sensitive credentials, the pipeline assumes trust and directly invokes cargo run, allowing arbitrary execution within the CI runner and potential exfiltration or misuse of secrets.
Potential impact
- Unauthorized use of
GITHUB_TOKENto push commits, alter repository contents, or tamper with history - Abuse of
SKIM_RS_BOT_PRIVATE_KEYto impersonate automated accounts or sign malicious artifacts - Injection of backdoors or malicious changes into the repository's codebase or generated files
- Compromise of release or automation pipelines that rely on the exposed credentials
- Persistent supply-chain risks if attacker-controlled changes are merged or trusted keys are reused elsewhere
General mitigation guidance
Effective mitigation focuses on separating untrusted contributions from privileged CI execution and secrets:
- Restrict sensitive secrets so they are not available to workflows triggered by pull requests from forks, or use explicit allowlists for trusted branches.
- Avoid running arbitrary project code (
cargo run, test harnesses with side effects, etc.) in jobs that expose long-lived or high-privilege credentials. - Introduce approval or gating mechanisms for workflows that need elevated permissions, such as manual approvals or required checks before secret-enabled jobs run.
- Apply least-privilege to CI tokens by reducing scopes (e.g., limiting
contents:writewhere possible) and scoping keys to specific tasks. - Use separate, low-privilege workflows for PR validation and reserve high-privilege workflows for post-merge or internal-only operations.
How teams detect issues like this
Organizations can detect similar vulnerabilities through a combination of configuration review and policy enforcement:
- Static analysis or policy-as-code tools inspecting CI configurations (e.g., GitHub Actions YAML) for patterns where:
- Secrets are exposed on
pull_requestor fork-based triggers - Untrusted code paths are executed (
run: cargo run, generic script runners) in the same job that uses privileged secrets - Manual or assisted code review focusing on:
- Workflows that run on external contribution triggers
- Jobs that combine checkout of fork code with secret usage
- CI governance rules that:
- Prohibit secrets in workflows triggered by untrusted actors
- Require approvals or additional checks before running privileged jobs
- Periodic audits of token scopes and key usage, ensuring secret distribution aligns with trust boundaries in the CI system.

