Skip to content

ci: close workflow-hardening and release archive-check gaps found reviewing #2794 - #2809

Merged
thiras merged 4 commits into
mainfrom
ci/2798-hardening-gaps
Nov 1, 2026
Merged

thiras merged 4 commits into
mainfrom
ci/2798-hardening-gaps

Conversation

@thiras

@thiras thiras commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

What

Closes the gaps the post-merge review of #2794 found.

  • Rule 6 false passes (check_workflow_hardening.py).

    • install-action now fails a checksum set to anything but true.
    • with_input reads a wrapped plain or quoted value as YAML folds it. A tool: list continued on a deeper line is now checked in full.
  • release.yml archive check. The "Each archive comes from its own target's artifact" step now refuses:

    • a flat download (any loose top-level entry);
    • no download at all;
    • an empty artifact directory;
    • hidden entries, via dotglob.

    A mismatch now says "does not name version $VERSION and target $target". The token sentence above the step ends at "only keeping untrusted code out of the run closes that".

  • A new harness, test_release_upload_assets.py.

    • It loads the step's run: from release.yml and runs it as shell: bash does.
    • It builds the real layout from the build-binaries matrix and asserts that the layout's archive count equals EXPECTED_ARCHIVES.
    • It covers each refused layout from the issue.
  • Toolchain docs. These now say that the toolchain: input sets the version and that a Rust release arrives as the docker ecosystem's rust: bump of deploy/sponsord:

    • .pre-commit-config.yaml
    • dependabot.yml (both comments)
    • the ci.yml toolchain-pin step comment
    • Cargo.toml
    • check_toolchain_pin.py: the docstring claim that a lone rust: bump builds on a different compiler is corrected, the site table leads with the input, and the error footer names the Dockerfile.
  • Guard wording.

    • The docstring and messages are narrowed to the images and tools the guard reads.
    • An out-of-scope paragraph names slither-action, setup-uv, aderyn-ci and cargo-semver-checks-action.
    • The local-action rules are corrected to 1, 2, 5 and 6.
    • The "no dash" scope is narrowed, and the clippy cache sentence is reworded.
  • Tests.

    • checksum (false, 'false' and true);
    • wrapped tool: values, plain and quoted;
    • fallback: none in the next step;
    • install-action in a local action;
    • mixed-case Taiki-E/Install-Action;
    • the .yml/.yaml row glob;
    • a subprocess test of check-workflow-hardening.sh's exit code.
  • The ed25519-vectors checkout comment is removed.

Reviewer notes

Verification

  • uvx --with pyyaml pytest .github/scripts/tests scripts/tests: 523 passed.

  • .github/scripts/check-workflow-hardening.sh: OK (148 refs). .github/scripts/check-toolchain-pin.sh: OK (22 sites).

  • Mutation proof, one mutant at a time. Each mutant fails its suite. The guard mutants:

    • drop the checksum clause;
    • drop the folding;
    • drop .lower();
    • make main() return 0 on errors.

    The release-step mutants:

    • drop dotglob;
    • drop the flat-layout guard;
    • drop the empty-list guard;
    • drop the empty-dir guard;
    • revert the version wording.
  • pre-commit run on the changed files passes. cargo-deny reports the pre-existing RUSTSEC-2026-0387 (crypto-bigint) as a non-blocking warning.

  • actionlint reports nothing in release.yml. Its ci.yml findings (code-quality scope, SC2012) are pre-existing.

  • No Rust, contract or API change, so clippy, nextest and the snapshots are not affected.

🤖 Generated with Claude Code

…iewing #2794

check_workflow_hardening.py rule 6 now refuses `checksum` set to anything
but `true`, and reads a wrapped plain or quoted `with:` value as YAML
folds it, so a second tool on a continuation line is checked. The
docstring and messages narrow to what the guard reads and name the
SHA-pinned actions that still install floating code.

release.yml's per-artifact archive check refuses a flat download, an
empty download, an empty artifact and hidden entries, and names the
version in its mismatch message. A new pytest runs the step from
release.yml against the build matrix's real layout and each refused one.

The toolchain-pin comments describe the post-#2794 path: the
`toolchain:` input sets the version and a Rust release arrives as the
docker ecosystem's `rust:` bump of deploy/sponsord.

Closes #2798

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 1, 2026 00:52
@thiras thiras self-assigned this Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

@github-code-quality

github-code-quality Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: Rust, Solidity

Rust / code-coverage/cargo-llvm-cov

main 1c67719 ci/2798-hardening-ga... 504d445 +/-
77% 77% 0%
View coverage of the 3 most impacted files.
File main 1c67719 ci/2798-hardening-ga... 504d445 +/-
crates/node/src/dht/publish.rs 80% 78% -2%
crates/protocol/src/framing.rs 93% 92% -1%
crates/cache/src/origin/mod.rs 53% 58% +5%

Solidity / code-coverage/forge

main 1c67719 ci/2798-hardening-ga... 504d445 +/-
92% 92% 0%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated November 01, 2026 01:10 UTC

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A suffix-matching hidden archive can bypass both hidden-entry rejection and the exact-count guard, requiring explicit rejection of dot-prefixed basenames and a regression test.

1 open issue
What changed in this PR

This PR strengthens CI and release checks following #2794, adding regression coverage and correcting documentation without changing Rust, contract, or API behavior.

Changes:

  • Tightens install-action validation for checksum settings and wrapped tool lists.
  • Adds release artifact layout checks and a harness that exercises the workflow’s shell step.
  • Clarifies guard coverage and how Dependabot-driven Rust toolchain updates propagate.
File Description
Cargo.toml Corrects the comment describing synchronized toolchain versions.
.pre-commit-config.yaml Clarifies the toolchain-pin hook’s purpose.
.github/​workflows/​release.yml Adds artifact layout validation and clearer diagnostics.
.github/​workflows/​ci.yml Updates toolchain comments and removes obsolete checkout commentary.
.github/​scripts/​tests/​test_release_upload_assets.py Adds workflow-backed archive validation tests.
.github/​scripts/​tests/​test_check_workflow_hardening.py Covers additional guard cases and wrapper exit codes.
.github/​scripts/​check_workflow_hardening.py Checks checksum inputs and wrapped scalars; clarifies scope.
.github/​scripts/​check_toolchain_pin.py Corrects toolchain documentation and error guidance.
.github/​dependabot.yml Clarifies Docker-driven Rust updates and action input versions.

Review effort: Balanced

Comment thread .github/workflows/release.yml Resolved
thiras and others added 3 commits November 1, 2026 03:58
…checks

A hidden archive whose name carries the right version and target passed
the per-artifact check, and the count and upload globs skip dotfiles, so
an impostor artifact went unnoticed. The step now refuses any dot-prefixed
name first.

check_workflow_hardening.py's with_input strips the folded value before
unquoting, so a value on the line after its key reads correctly, and
returns a quoted value whose close it did not find with its opening
quote, so every comparison fails rather than passing a truncated value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…h tests

Name every floating download the guard leaves out of scope, the clippy
cache's path into the release, rule 5's job keys, and where
download-artifact extracts flat. RELEASING.md and CONTRIBUTING.md name the
stable toolchain cargo-semver-checks-action installs.

Tests pin folding across a blank line, a checksum other than a literal
true, and the duplicate-name guard; the wrapper test drops inherited GIT_*
variables.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…hives

The runner matches a step's input names without regard to case, so
`Checksum: false` turned checksums off while the hardening check read the
input as unset. with_input now compares names case-blind; an expression
used as an input name joins the declared out-of-scope shapes.

The per-artifact archive check refuses an artifact named `binaries-` with
no target, and any entry that is not a regular file: a symlink moved to the
top level would be checksummed with another archive's bytes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@thiras
thiras merged commit ddb59a0 into main Nov 1, 2026
40 checks passed
@thiras
thiras deleted the ci/2798-hardening-gaps branch November 1, 2026 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants