Skip to main content

SKY-D372 · CI/CD pipelines

Unverified download reaching the publish step

High

A job that publishes a package first downloads a file, for example a prebuilt archive from a CDN, and nothing checks its checksum or signature before the publish step runs. Whatever the server returned that day ends up inside the package you ship.

Languages
GitHub Actions workflows, GitLab CI
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

Whoever controls the download server, or the account that uploads to it, controls part of your release. The @subql 5.8.3 release swapped a package folder for such an archive, and users installed it from the official registry.

What Skylos flags

.github/workflows/publish.yml · YAMLReported on line 21
name: Publish SDKon:  release:    types: [published]permissions:  contents: readjobs:  npm:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955        with:          persist-credentials: false      - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020        with:          node-version: 22          registry-url: https://registry.npmjs.org      - run: npm ci      - name: Fetch prebuilt native binaries        run: |          curl -fsSL -o prebuilt.tar.gz https://dl.acme.example/sdk/prebuilt.tar.gz          tar -xzf prebuilt.tar.gz -C packages/sdk/prebuilt      - run: npm publish ./packages/sdk --access public        env:          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

What Skylos leaves alone

.github/workflows/publish.yml · YAML
name: Publish SDKon:  release:    types: [published]permissions:  contents: readjobs:  npm:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955        with:          persist-credentials: false      - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020        with:          node-version: 22          registry-url: https://registry.npmjs.org      - run: npm ci      - name: Fetch prebuilt native binaries        run: |          curl -fsSL -o prebuilt.tar.gz https://dl.acme.example/sdk/prebuilt.tar.gz          gh attestation verify prebuilt.tar.gz --repo acme/sdk-native          tar -xzf prebuilt.tar.gz -C packages/sdk/prebuilt        env:          GH_TOKEN: ${{ github.token }}      - run: npm publish ./packages/sdk --access public        env:          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Why Skylos leaves it alone

The same archive is downloaded and published, but gh attestation verify checks GitHub's build attestation for it before it is unpacked, so a swapped file stops the job.

More languages

YAML

Flagged

.gitlab-ci.yml · YAMLReported on line 10
stages: [publish] publish:  stage: publish  image: node:22-slim  rules:    - if: $CI_COMMIT_TAG  script:    - npm ci    - curl -fsSL -o dist.tgz https://cdn.acme.example/web/dist.tgz    - tar -xzf dist.tgz -C packages/web/dist    - npm publish ./packages/web

Not flagged

.gitlab-ci.yml · YAML
stages: [publish] publish:  stage: publish  image: node:22-slim  rules:    - if: $CI_COMMIT_TAG  script:    - npm ci    - curl -fsSL -o dist.tgz https://cdn.acme.example/web/dist.tgz    - sha256sum -c release/dist.tgz.sha256    - tar -xzf dist.tgz -C packages/web/dist    - npm publish ./packages/web
release/dist.tgz.sha256 · Text
0000000000000000000000000000000000000000000000000000000000000000  dist.tgz

Why Skylos leaves it alone

sha256sum -c compares the archive with a checksum committed to the repository before it is unpacked, so a changed file fails the job.

How Skylos decides

  1. Runs with --danger (and -a). The ca9 library reads every *.yml and *.yaml file directly in .github/workflows, the local composite actions they call, and .gitlab-ci.yml with its local includes.
  2. Finds downloads in run: steps and GitLab script lines: curl with -o, -O or a redirect to a file, wget, gh release download, Invoke-WebRequest -OutFile, and curl … | tar -x. Uploads (curl --data, --form, -T) and downloads to standard output or /dev/ are not downloads.
  3. Follows the file: a later tar -x or unzip of it says where it is unpacked, mv or cp where it moves. A download that is only run as a tool from a bin folder or outside the workspace is left to SKY-D371.
  4. Reports the download when it lands in the workspace and the job publishes after it (a publish command later in the job, or a publish credential the job holds), unless a checksum check (sha256sum -c and the other *sum programs, or a comparison with a hash) or a signature check (gpg --verify, cosign verify-blob, slsa-verifier, minisign -V, gh attestation verify) comes after it and names the file or is in the same step.
  5. Reports one HIGH finding per unverified download, on the download's line.

How to fix it

Do not publish files fetched at release time when you can build them in the job. If you must, download a fixed, versioned URL and check it against a checksum committed to the repository, or verify its signature or attestation, before it is unpacked.

.github/workflows/publish.yml · YAML · the fix, against the flagged file
name: Publish SDKon:  release:    types: [published]permissions:  contents: readjobs:  npm:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955        with:          persist-credentials: false      - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020        with:          node-version: 22          registry-url: https://registry.npmjs.org      - run: npm ci      - name: Fetch prebuilt native binaries        run: |Removed:           curl -fsSL -o prebuilt.tar.gz https://dl.acme.example/sdk/prebuilt.tar.gzAdded:           curl -fsSL -o prebuilt.tar.gz \Added:             https://dl.acme.example/sdk/v1.4.0/prebuilt.tar.gzAdded:           sha256sum -c packages/sdk/prebuilt.sha256          tar -xzf prebuilt.tar.gz -C packages/sdk/prebuilt      - run: npm publish ./packages/sdk --access public        env:          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

When it can be wrong

  • Any checksum or signature command in the same step counts as a check of the file, even one that checks a different file.
  • A download in a job that only holds a publish credential is reported even when no step ever packs the file, because the credential is treated as a publish at the end of the job.
  • The flagged example also gets SKY-D364 for the stored npm token. It is a separate finding about the same job.

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, neither as a YAML comment nor as a shell comment inside the run: block.

  • Accept a reviewed job 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-D372"] turns the rule off for the whole project.

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