Skip to main content

SKY-D376 · CI/CD pipelines

Secrets passed to a reusable workflow from another repository

Medium

A job can call a reusable workflow stored in another repository (uses: owner/repo/.github/workflows/x.yml@ref) and hand it secrets, an OIDC token or a write token. SKY-D376 reports that hand-off so someone reviews the other repository, because Skylos cannot see what that workflow does with them.

Languages
GitHub Actions workflows
Quality gate
Full scan: listed, not counted by the gate. Diff scan: counted toward the gate limits. A diff scan counts a finding whose rule, file and job name are not among the merge base's findings. A baseline scan counts it like a diff scan when the baseline's rule_coverage lists it.
Finding type
review
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

The called workflow runs with your publish token, and whoever can change that repository, or move the tag you call, decides what runs. A compromised shared release workflow can publish to every package that calls it.

What Skylos flags

.github/workflows/release.yml · YAMLReported on line 9
name: Releaseon:  push:    tags: ["v*"]permissions:  contents: readjobs:  publish:    uses: acme/release-workflows/.github/workflows/npm-publish.yml@v2    with:      package-dir: packages/sdk    secrets:      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

What Skylos leaves alone

.github/workflows/ci.yml · YAML
name: CIon:  pull_request:  push:    branches: [main]permissions:  contents: readjobs:  test:    uses: acme/ci/.github/workflows/test.yml@0f1e2d3c4b5a69788796a5b4c3d2e1f00f1e2d3c    with:      node-version: 22

Why Skylos leaves it alone

The shared workflow also lives in another repository, but this job hands it nothing secret: no secrets, no id-token: write and only a read-only token.

How Skylos decides

  1. Runs with --danger (and -a). The ca9 library reads every *.yml and *.yaml file directly in .github/workflows.
  2. Looks at jobs whose uses: names a workflow outside the repository. uses: ./.github/workflows/… is local and is audited with the other publish rules instead.
  3. Collects what the job hands over: secrets: inherit, toJSON(secrets), every secrets.NAME the job's values mention (in secrets:, with: or if:), id-token: write, and write scopes of GITHUB_TOKEN when the job or workflow sets permissions:.
  4. Reports a MEDIUM finding on the uses: line when that list is not empty, whether or not the reference is pinned to a commit SHA. The message says which.

How to fix it

Keep the release workflow in this repository (here a copy at .github/workflows/npm-publish.yml), where Skylos and your reviewers can read it. If you must call a shared one, pin it to a full commit SHA, pass only the secrets it needs (never secrets: inherit), audit that repository with the same rules, and record the review in a baseline, because the call stays reported.

.github/workflows/release.yml · YAML · the fix, against the flagged file
name: Releaseon:  push:    tags: ["v*"]permissions:  contents: readjobs:  publish:Removed:     uses: acme/release-workflows/.github/workflows/npm-publish.yml@v2Added:     uses: ./.github/workflows/npm-publish.yml    with:      package-dir: packages/sdk    secrets:      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

When it can be wrong

  • A call pinned to a reviewed commit SHA, in a repository your organisation owns, is still reported: the rule cannot read the other repository.
  • Any secrets.NAME mentioned in the job counts, even a non-secret setting stored as a secret.
  • The flagged example also gets SKY-D292 because @v2 is not a commit SHA. With secrets: inherit it would also get SKY-D297.

Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.

How to silence it

  • Skylos reads no inline marker for this rule; a # skylos: ignore comment above the uses: line does not hide it.

  • Accept a reviewed call with a baseline: skylos baseline ., then --baseline. The entry matches the rule, file and job name, not the line. In pull-request CI (SKYLOS_POLICY_BASE), the entry must also be in the base commit's .skylos/baseline.json.

  • [tool.skylos] ignore = ["SKY-D376"] turns the rule off for the whole project.

From the Skylos rule handbook, Skylos 5.8.0 (commit 5b880b0). All rules.