SKY-D297 · CI/CD pipelines
Reusable workflow gets every secret with secrets inherit
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
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
name: Deploy to stagingon: push: branches: [main]permissions: contents: readjobs: deploy: uses: ./.github/workflows/deploy.yml with: environment: staging secrets: inheritWhat Skylos leaves alone
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
- Reads workflow files under
.github/workflows. - Looks at jobs that call a reusable workflow with
uses:, whether it is a file in the same repository or one in another repository. - Reports the job when its
secretsvalue is exactlyinherit. A mapping of named secrets is not reported. - The trigger and the called workflow are not read. One MEDIUM finding per job, on that job's
secrets: inheritline.
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.
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.