Skip to main content

SKY-D310 · CI/CD pipelines

OIDC publish job runs repository build scripts

High

permissions: id-token: write lets a job ask GitHub for an OIDC token, which PyPI, npm and cloud providers accept in place of a stored password. SKY-D310 reports a job that holds this permission and also runs build scripts from the repository, such as make or ./scripts/build.sh.

Languages
GitHub Actions workflows
Quality gate
counted toward the gate limits (full and diff scans)
Finding type
review
Catalog name
GitHub Actions OIDC build-script exposure
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

Everything those scripts run, including the build tools and plugins they pull in, can request the same token and publish a release or reach the cloud account. One bad change to a Makefile, or one compromised build dependency, is enough to ship a malicious version under your name.

What Skylos flags

.github/workflows/publish.yml · YAMLReported on line 23
name: Publishon:  release:    types: [published]permissions:  contents: readjobs:  publish:    name: Build and publish to PyPI    runs-on: ubuntu-latest    timeout-minutes: 15    environment: pypi    permissions:      contents: read      id-token: write    steps:      - uses: actions/checkout@v4        with:          persist-credentials: false      - uses: actions/setup-python@v5        with:          python-version: "3.12"      - run: make dist      - uses: pypa/gh-action-pypi-publish@release/v1

What Skylos leaves alone

.github/workflows/docs.yml · YAML
name: Docson:  push:    branches: [main]permissions:  contents: readjobs:  deploy:    name: Deploy docs to S3    runs-on: ubuntu-latest    timeout-minutes: 15    environment: docs    permissions:      contents: read      id-token: write    steps:      - uses: actions/checkout@v4        with:          persist-credentials: false      - uses: aws-actions/configure-aws-credentials@v4        with:          role-to-assume: arn:aws:iam::123456789012:role/deploy-docs          aws-region: eu-west-1      - run: aws s3 sync docs/ s3://docs.example.com --delete

Why Skylos leaves it alone

This job also holds id-token: write and runs a command, but the command is the AWS CLI from the runner image. The files it uploads are data; no script from the repository runs while the token is available.

How Skylos decides

  1. Reads workflow files under .github/workflows. Jobs that call a reusable workflow are skipped.
  2. Keeps jobs whose effective permissions grant id-token: write: the job's own permissions: when it has one, otherwise the workflow's. permissions: write-all counts.
  3. In those jobs, looks for a run: block with a line that starts with a repository script or build entry point: ./scripts/, ./ci/, ./build/, ./tools/, ./release/ or ./deploy/; bash, sh, python, node, ruby or pwsh running a file in one of those folders; npm run, pnpm run, yarn run or bun run; or make.
  4. Reports HIGH once per job, on the first matching step, at the first line of the file that contains the step's first command line.

How to fix it

Build in a job without id-token: write, upload the files as an artifact, and publish them from a second job that holds the token and runs only the publish action.

.github/workflows/publish.yml · YAML · the fix, against the flagged file
name: Publishon:  release:    types: [published]permissions:  contents: readjobs:Removed:   publish:Removed:     name: Build and publish to PyPIAdded:   build:Added:     name: Build the distributions    runs-on: ubuntu-latest    timeout-minutes: 15Removed:     environment: pypiRemoved:     permissions:Removed:       contents: readRemoved:       id-token: write    steps:      - uses: actions/checkout@v4        with:          persist-credentials: false      - uses: actions/setup-python@v5        with:          python-version: "3.12"      - run: make distAdded:       - uses: actions/upload-artifact@v4Added:         with:Added:           name: distAdded:           path: dist/Added:           if-no-files-found: errorAdded:   publish:Added:     name: Publish to PyPIAdded:     needs: buildAdded:     runs-on: ubuntu-latestAdded:     timeout-minutes: 15Added:     environment: pypiAdded:     permissions:Added:       contents: readAdded:       id-token: writeAdded:     steps:Added:       - uses: actions/download-artifact@v4Added:         with:Added:           name: distAdded:           path: dist/      - uses: pypa/gh-action-pypi-publish@release/v1

When it can be wrong

  • The check matches text, not what runs. A make line that only prints a version is reported. Commands that also run repository code but match none of the patterns are missed: python -m build, pip install ., npm publish, cargo build, a script in another folder such as ./bin/release, or cd web && npm run build.
  • An id-token: write used only to log in to a cloud provider is treated the same as one used to publish.

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-D310] <reason> on the reported line or on the line directly above it, one rule per marker.

    YAML
    # skylos: ignore[SKY-D310] make only checks the version tag- run: make check-version
  • [tool.skylos] ignore = ["SKY-D310"] turns the rule off for the whole project. A baseline also works, but it records the absolute file path and line, so it stops matching when the checkout moves or lines above the finding change.

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