Skip to main content

SKY-D297 · CI/CD pipelines

Reusable workflow gets every secret with secrets inherit

High

The catalog lists HIGH, but the detector reports every finding as MEDIUM.

A job can call another workflow file, a reusable workflow, with uses:. secrets: inherit hands that workflow every repository and organization secret the caller can read. SKY-D297 reports each job that calls a reusable workflow this way.

Languages
GitHub Actions workflows
Quality gate
counted toward the gate limits (full and diff scans)
Finding type
review
Catalog name
GitHub Actions secrets inheritance
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, and every action it runs, can read secrets it never needed, such as a production deploy key or a package publish token. One compromised action or a careless edit there then leaks all of them instead of the one it was meant to use.

What Skylos flags

.github/workflows/deploy-staging.yml · YAMLReported on line 12
name: Deploy to stagingon:  push:    branches: [main]permissions:  contents: readjobs:  deploy:    uses: ./.github/workflows/deploy.yml    with:      environment: staging    secrets: inherit

What Skylos leaves alone

.github/workflows/deploy-staging.yml · YAML
name: Deploy to stagingon:  push:    branches: [main]permissions:  contents: readjobs:  deploy:    uses: ./.github/workflows/deploy.yml    with:      environment: staging    secrets:      DEPLOY_TOKEN: ${{ secrets.STAGING_DEPLOY_TOKEN }}

Why Skylos leaves it alone

The job still passes secrets to the reusable workflow, but names the one it needs. Every other secret stays out of the called workflow's reach.

How Skylos decides

  1. Reads workflow files under .github/workflows.
  2. Looks at jobs that call a reusable workflow with uses:, whether it is a file in the same repository or one in another repository.
  3. Reports the job when its secrets value is exactly inherit. A mapping of named secrets is not reported.
  4. The trigger and the called workflow are not read. One MEDIUM finding per job, on that job's secrets: inherit line.

How to fix it

Declare the secrets the reusable workflow needs under on.workflow_call.secrets in that file, and pass exactly those from the caller, each mapped to the secret it should receive.

.github/workflows/deploy-staging.yml · YAML · the fix, against the flagged file
name: Deploy to stagingon:  push:    branches: [main]permissions:  contents: readjobs:  deploy:    uses: ./.github/workflows/deploy.yml    with:      environment: stagingRemoved:     secrets: inheritAdded:     secrets:Added:       DEPLOY_TOKEN: ${{ secrets.STAGING_DEPLOY_TOKEN }}

When it can be wrong

  • A reusable workflow in the same repository that really uses many secrets is reported the same as an outside one.
  • Calls to a reusable workflow in another repository can also get SKY-D376, which reports secrets handed to outside code.

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

  • Put # skylos: ignore[SKY-D297] on the reported line or on the line directly above it, one rule per marker.

    YAML
    uses: ./.github/workflows/deploy.yml# skylos: ignore[SKY-D297] same-repo workflow, reviewed with CODEOWNERSsecrets: inherit
  • [tool.skylos] ignore = ["SKY-D297"] turns the rule off for the whole project.

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