Skip to content

ci: close check-workflow-hardening gaps and stale toolchain docs found reviewing #2794 #2798

Closed

Description

@thiras

The review of #2794 found these after it merged. #2794 pinned every workflow and widened .github/scripts/check_workflow_hardening.py to all of them. Each item below was confirmed against a scratch copy of the guard, the extracted release.yml step, or upstream source at the pinned SHA.

1. Rule 6 passes installs that float or skip the checksum (guard false passes)

  • checksum: false passes rule 6. install-action v2.87.32 (5488ac5) has a checksum input, default true. checksum: false turns off the sha256 check that rule 6 exists to keep. A step with tool: [email protected], fallback: none and checksum: false makes check() return []. Fix: also require that checksum is unset or true, and add a test.

  • A wrapped tool: value is read only up to its first line. with_input returns the first line of a plain or double-quoted scalar. YAML folds the next line into the value, and install-action splits it on commas and spaces. With

            with:
              tool: [email protected],
                cargo-llvm-cov
              fallback: none

    check() passes, and cargo-llvm-cov installs at latest. Fix: treat lines indented deeper than the input key as part of a non-block value, or report them as unreadable. Add a test.

2. upload-assets can pass while checking nothing (release.yml, the "Each archive comes from its own target's artifact" step)

  • A flat layout skips the check. download-artifact v8.0.2 extracts flat when exactly one artifact matches, or when merge-multiple is set (src/download-artifact.ts). for dir in */ under nullglob then runs zero times and the step exits 0. Nothing triggers this today: there are 6 build legs and no merge-multiple. But a smaller matrix, or merge-multiple added back, turns the guarantee off without any error. Fix: refuse loose top-level files, and refuse an empty directory list.
  • An empty artifact directory passes. rmdir succeeds on it, and the count of 15 is blind to names. So an empty binaries-aarch64-pc-windows-msvc/ plus an extra, correctly targeted archive elsewhere writes a 15-entry SHA256SUMS without the Windows ARM64 CLI. Fix: fail on an empty $dir.
  • A version mismatch is reported as a target mismatch. A wrong-version archive fails with "does not name target …". Say "does not name version $VERSION and target $target".
  • Add a pytest harness. The step only runs on a tag, so a regression either goes unseen or breaks a release. Read the step's run: from release.yml with yaml.safe_load, as test_solidity_path_filter.py does for ci.yml. Run it under bash -eo pipefail against:
    • the real 15-archive layout;
    • an impostor binaries-evil;
    • a file that names another target;
    • a directory not named binaries-*;
    • a hidden file;
    • a flat layout;
    • an empty directory.

3. Stale or wrong toolchain-bump docs

#2794 moved every dtolnay/rust-toolchain step to a SHA plus a toolchain: input, so Dependabot's github-actions ecosystem no longer moves Rust. A Rust release now arrives through the docker ecosystem's rust:X.Y.Z bump of deploy/sponsord, as in #2545. These still describe the old path:

  • .pre-commit-config.yaml:108-111 (toolchain-pin hook comment): "every dtolnay/rust-toolchain@… ref … Dependabot bumps only the action refs".
  • .github/dependabot.yml:47-50 (the docker /deploy/sponsord comment): "…and the action refs move with it". It should say the workflows' toolchain: inputs.
  • .github/workflows/ci.yml:1373-1378 (toolchain-pin step comment): "Dependabot bumps only the action refs". Its scope also leaves out sdk-contract.yml and the Dockerfile.
  • Cargo.toml:44-47: "every dtolnay/rust-toolchain@… ref … compared byte-for-byte". The value compared is the toolchain: input.
  • check_toolchain_pin.py:16-23 (added in ci: pin every workflow and download release artifacts by source #2794) is wrong. It says a lone rust: bump "leaves the image building on a different compiler". In fact deploy/sponsord/Dockerfile copies rust-toolchain.toml in, and the image's rustup proxy builds with 1.99.1. A lone bump only leaves the base image's toolchain unused and makes the Dockerfile's "The toolchain tag is the workspace's pinned toolchain" false. Reword it to say that.
  • check_toolchain_pin.py:10-12 site table: lead with the toolchain: input, not @X. Also name deploy/sponsord/Dockerfile in its error footer (:241-244).
  • dependabot.yml:75-81: add that Dependabot may still move the dtolnay SHA to a newer master commit. The toolchain: input, not the ref, sets the version.

4. The guard's docstring and messages overclaim

  • "floats an action, an image or a tool" and "every image by digest and every tool by version" (module docstring, error text and OK text). The guard passes several things that float:

    • crytic/slither-action (ci.yml) builds FROM python:3.10 and installs the newest slither from PyPI;
    • astral-sh/setup-uv (sdk-contract.yml) sets no version;
    • Cyfrin/aderyn-ci runs npm install -g @cyfrin/[email protected];
    • cargo-semver-checks-action floats too, as documented.

    All of these run under read-only tokens. Narrow the wording to install-action tools and IMAGE_INPUTS images, or pin these as well (slither-version, a setup-uv version).

  • Where the rules apply. The docstring says local actions are held to rules 1 and 2, and the check_actions docstring says the same. They are held to rules 1, 2, 5 and 6.

  • "a step with no dash" is an error only for checkout, install-action and IMAGE_INPUTS steps. Narrow that sentence.

  • The clippy cache sentence reads as a token permission. The cache is saved with the runtime token, and only on main. Reword it.

5. Missing tests (each mutant below survives the current suite)

  • The *.yml side of the workflow glob. test_workflow_without_a_row_fails writes only extra.yaml. Parametrize it over .yml and .yaml.
  • main() returns 1 on errors. Every test calls check(). Add a subprocess test of check-workflow-hardening.sh in a git init'd tmp repo, as test_check_image_name.py does.
  • fallback: none in another step does not count. Mirror test_persist_false_in_the_next_step_does_not_count.
  • install-action inside a local composite action is checked.
  • A mixed-case Taiki-E/Install-Action@<sha> does not skip rule 6.

6. Smaller items

  • The release.yml upload-assets comment says the read-only build tokens limit artifact replacement. Artifact uploads use the runtime token, which permissions: does not limit. End the sentence at "only keeping untrusted code out of the run closes that".
  • The CHANGELOG ci: pin every workflow and download release artifacts by source #2794 entry has no PR number. Add (#2794).
  • The ci.yml ed25519-vectors checkout comment (:815-818) justifies persist-credentials: false for that one job. Every checkout now sets it, so remove the comment.

Activity

  1. added
    kind:security
    prio:medium
    on Oct 30, 2026
  2. self-assigned this
    on Oct 30, 2026
  3. added
    area:ci
    on Oct 30, 2026
  4. moved this from Backlog to Done in deCDNon Nov 1, 2026
  5. added a commit that references this issue on Nov 3, 2026
    ddb59a0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:cikind:securityprio:medium

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions