Repository navigation
Description
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: falsepasses rule 6. install-action v2.87.32 (5488ac5) has achecksuminput, defaulttrue.checksum: falseturns off the sha256 check that rule 6 exists to keep. A step withtool: [email protected],fallback: noneandchecksum: falsemakescheck()return[]. Fix: also require thatchecksumis unset ortrue, and add a test. -
A wrapped
tool:value is read only up to its first line.with_inputreturns 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. Withwith: tool: [email protected], cargo-llvm-cov fallback: none
check()passes, andcargo-llvm-covinstalls atlatest. 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-multipleis set (src/download-artifact.ts).for dir in */undernullglobthen runs zero times and the step exits 0. Nothing triggers this today: there are 6 build legs and nomerge-multiple. But a smaller matrix, ormerge-multipleadded 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.
rmdirsucceeds on it, and the count of 15 is blind to names. So an emptybinaries-aarch64-pc-windows-msvc/plus an extra, correctly targeted archive elsewhere writes a 15-entrySHA256SUMSwithout 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:fromrelease.ymlwithyaml.safe_load, astest_solidity_path_filter.pydoes forci.yml. Run it underbash -eo pipefailagainst:- 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-pinhook comment): "every dtolnay/rust-toolchain@… ref … Dependabot bumps only the action refs". -
.github/dependabot.yml:47-50(the docker/deploy/sponsordcomment): "…and the action refs move with it". It should say the workflows'toolchain:inputs. -
.github/workflows/ci.yml:1373-1378(toolchain-pinstep comment): "Dependabot bumps only the action refs". Its scope also leaves out sdk-contract.yml and the Dockerfile. -
Cargo.toml:44-47: "everydtolnay/rust-toolchain@…ref … compared byte-for-byte". The value compared is thetoolchain: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 lonerust:bump "leaves the image building on a different compiler". In factdeploy/sponsord/Dockerfilecopiesrust-toolchain.tomlin, 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-12site table: lead with thetoolchain:input, not@X. Also namedeploy/sponsord/Dockerfilein its error footer (:241-244). -
dependabot.yml:75-81: add that Dependabot may still move the dtolnay SHA to a newermastercommit. Thetoolchain: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) buildsFROM python:3.10and installs the newest slither from PyPI;astral-sh/setup-uv(sdk-contract.yml) sets noversion;Cyfrin/aderyn-cirunsnpm install -g @cyfrin/[email protected];cargo-semver-checks-actionfloats too, as documented.
All of these run under read-only tokens. Narrow the wording to install-action tools and
IMAGE_INPUTSimages, or pin these as well (slither-version, a setup-uvversion). -
Where the rules apply. The docstring says local actions are held to rules 1 and 2, and the
check_actionsdocstring 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_INPUTSsteps. Narrow that sentence. -
The
clippycache sentence reads as a token permission. The cache is saved with the runtime token, and only onmain. Reword it.
5. Missing tests (each mutant below survives the current suite)
- The
*.ymlside of the workflow glob.test_workflow_without_a_row_failswrites onlyextra.yaml. Parametrize it over.ymland.yaml. -
main()returns 1 on errors. Every test callscheck(). Add a subprocess test ofcheck-workflow-hardening.shin agit init'd tmp repo, astest_check_image_name.pydoes. -
fallback: nonein another step does not count. Mirrortest_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.ymlupload-assets comment says the read-only build tokens limit artifact replacement. Artifact uploads use the runtime token, whichpermissions: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.ymled25519-vectors checkout comment (:815-818) justifiespersist-credentials: falsefor that one job. Every checkout now sets it, so remove the comment.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity
ci: close workflow-hardening and release archive-check gaps found rev…