SKY-D291 · CI/CD pipelines
GitHub Actions missing or broad token permissions
Every workflow job gets a GITHUB_TOKEN, and its permissions: block says what that token may do. Without one, the job gets the repository's default, which can be read-write. SKY-D291 reports workflows that leave the token at the default, and grants that are broader than the jobs need.
- Languages
- GitHub Actions workflows
- Quality gate
- counted toward the gate limits (full and diff scans)
- Finding type
- review
- Catalog name
- GitHub Actions excessive permissions
Why it matters
Any step can read the token: a compromised action, a dependency's install script, or a test that runs pull request code. With write access it can push commits, move release tags or approve its own changes, so one bad dependency becomes a change to your default branch.
What Skylos flags
name: CIon: push: branches: [main] pull_request:jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - run: make test lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - run: make lintWhat Skylos leaves alone
name: Releaseon: push: tags: ["v*"]permissions: contents: writejobs: release: runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - run: make dist - run: gh release create "$GITHUB_REF_NAME" dist/* env: GH_TOKEN: ${{ github.token }}Why Skylos leaves it alone
contents: write sits at the workflow level, but only one job inherits it, so it is already as narrow as a job-level grant. Skylos reports a workflow-level write only when two or more jobs inherit it.
How Skylos decides
- Reads workflow files under
.github/workflows. A job's ownpermissions:replaces the workflow's completely, so workflow-level values are judged only by the jobs that inherit them (jobs without their own block). - No workflow-level
permissions:and at least one job without its own: one MEDIUM finding on line 1, naming those jobs. When every job declares its own, nothing is reported. - Workflow-level
read-allorwrite-allwith at least one inheriting job: MEDIUM forread-all, HIGH forwrite-all. - Workflow-level scopes set to
writewith two or more inheriting jobs: one finding per write scope, graded by scope (see the severity note). With one inheriting job it is not reported. - A job's own
read-all(MEDIUM) orwrite-all(HIGH) is reported on that job. A job's own list of scopes, writes included, is never reported.
How to fix it
Declare a read-only default at the top and grant writes only on the job that needs them.
name: CIon: push: branches: [main] pull_request:Added: permissions:Added: contents: readjobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - run: make test lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - run: make lintWhen it can be wrong
- A missing block is reported even when the repository or organization already sets the default token to read-only. Skylos cannot see that setting.
read-allis reported, although it grants no write access, because it reads more than most jobs need.
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-D291]on the reported line or the line directly above it. A missing block is always reported on line 1, so that marker goes on the first line of the file.YAML # skylos: ignore[SKY-D291] org default token is read-onlyname: CIA baseline (
skylos baseline ., then--baseline) also hides it. The entry is the rule, the absolute file path and the line, so it stops matching when the checkout moves to another path.[tool.skylos] ignore = ["SKY-D291"]turns the rule off for the whole project.