Skip to content

ci: a release was neither signed nor reproducible - #76

Merged
jamesconwaydev merged 1 commit into
parsec-html:mainfrom
foothillsdigital:ci/signed-releases
Nov 18, 2026
Merged

jamesconwaydev merged 1 commit into
parsec-html:mainfrom
foothillsdigital:ci/signed-releases

Conversation

@foothillsdigital

Copy link
Copy Markdown
Collaborator

Problem

There was no release workflow, so nothing was signed or attested, and nothing showed a release could be rebuilt bit for bit. Silver asks for signed releases, and gold for reproducible builds.

Fixes #57

Change

As agreed on #57.

release.yml, on a v* tag:

  1. tag: git tag -v against .github/allowed_signers taken from main, not from the tagged commit. Someone who can push a tag could also change the file the tag is checked with. The tag is fetched again by name, so the annotated tag, not a lightweight ref, is what's verified.
  2. build: scripts/package-twice.sh, which packages the crate twice from fresh checkouts and fails unless both are identical.
  3. publish:
    • actions/attest-build-provenance on the .crate;
    • then gh release create --verify-tag with the crate, SHA256SUMS and the provenance bundle.

A manual run skips the tag check and publishing, to try a release first. Permissions are contents: read everywhere except publish, which gets contents: write, id-token: write and attestations: write. Every action is pinned by commit.

.github/allowed_signers: your key, with namespaces="git" so it's trusted for git signatures only. I checked it against https://github.com/jamesconwaydev.keys and your account's SSH signing keys.

scripts/package-twice.sh: the build, for CI and for anyone checking a release. It uses worktrees, so it works in a shallow clone. The first checks out with umask 022 and the second with 077, so checkout modes can't leak into the package.

crates/parsec/Cargo.toml: exclude = ["tests/html5lib-tests"]. With the submodule checked out, cargo package took all 49 of its files, 140 in all instead of 91, so a rebuild in an ordinary checkout hashed differently from the release. The manifests aren't synced from Netweir (sync-from-netweir.sh: "the manifests are Parsec's own").

ci.yml: a reproducible job runs the script and also packages from its own checkout, which has the submodules. All three must match, so a change that would break a rebuild fails on the pull request.

SECURITY.md: "Verifying a release": the tag (git tag -v), the attestation (gh attestation verify --signer-workflow …/release.yml), and a rebuild with the script.

Tests

  • What moves the hash. The .crate came out byte-identical from two separate clones, and also with:

    • a checkout under umask 077;
    • no SOURCE_DATE_EPOCH;
    • cargo 1.99.1 and cargo 1.101.0-nightly.

    Only the submodule changed it, which the exclude fixes: cargo package --list with and without it is now the same 91 files.

  • The script in a shallow clone: a git clone --depth 1 gives the same hash as a full clone.

  • The tag check, against a throwaway key:

    • signed by the listed key: verified;
    • signed by another key: refused;
    • lightweight tag: refused;
    • unsigned annotated tag: refused.
  • Lint and tests: actionlint passes on both workflows, shellcheck on the script, scripts/check-headers.sh passes, and cargo fmt, clippy -D warnings and cargo test --workspace pass locally.

Not tried: the publish job itself, which only runs on a real tag. A manual run of release on the branch would exercise build.

For the repository settings, which this can't do: a tag ruleset limiting who can create v* tags. The workflow at the tagged commit is what runs, so the signature check is only as strong as who can push a tag.

Checklist

  • cargo fmt, cargo clippy -- -D warnings and cargo test pass locally
  • Tests cover the change, and a bug fix has the test that would have caught it
  • Changes to crates/parsec/src, its tests, examples, scripts or fuzz targets were made in Netweir first (see CONTRIBUTING.md). n/a: only the manifest, which is Parsec's own.
  • The wiki is updated if the change is visible to people using Parsec. SECURITY.md has the verification steps; a wiki page can point to it once the first release is out.
  • It's my own work, and not copied from another project in breach of its licence

There was no release workflow. A v* tag now starts one that checks the
tag's SSH signature against .github/allowed_signers taken from main,
packages the crate twice from fresh checkouts and fails unless the two
are the same byte for byte, attests the .crate, and publishes it with
its SHA256SUMS and the provenance bundle. A manual run builds without
the tag check or publishing.

scripts/package-twice.sh is that build, for CI and for anyone checking
a release; a reproducible job in ci.yml runs it on every change. The
html5lib-tests submodule is excluded from the package, since with it
checked out the crate held 140 files instead of 91 and hashed
differently. SECURITY.md says how to verify the tag, the attestation
and a rebuild.

@jamesconwaydev jamesconwaydev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is careful work, thank you. Checking the tag against allowed_signers from main rather than from the tagged commit, and catching the submodule leaking into the package, are both things I'd have missed.

On the tag ruleset: agreed. I'm adding a creation rule to the v* ruleset so only admins can create release tags, on top of the deletion and update rules it already has.

@jamesconwaydev
jamesconwaydev merged commit e464178 into parsec-html:main Nov 18, 2026
9 checks passed
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.

Signed, reproducible releases

2 participants