Skip to content

ci: require a DCO sign-off, scope Pages grants, keep the crates.io token off argv - #732

Merged
vladimirrott merged 3 commits into
mainfrom
ci/dco-check
Oct 29, 2026
Merged

vladimirrott merged 3 commits into
mainfrom
ci/dco-check

Conversation

@vladimirrott

Copy link
Copy Markdown
Member

Summary

Three CI changes from the OpenSSF review, in two commits.

A required DCO sign-off (#713). scripts/check_dco.sh BASE HEAD reads the non-merge commits in the range and fails any without a Signed-off-by trailer, as git parses trailers, whose address matches the commit author's. It accepts Dependabot's one pairing (it authors as its noreply address and signs off as support@github.com) and no other. An empty, unresolvable or merge-only range gets refused with "nothing was checked". On failure it prints the commands that sign off pushed commits; they fetch main by URL, so they work from a fork whatever its remotes are called. A new dco job runs it on every pull request with full history. CONTRIBUTING.md, docs/contributing/CONTRIBUTING.md, the developer guide and the PR template now say a sign-off is required. The developer guide also names the seven required checks in place of a stale "five".

Pages and OIDC grants scoped to the deploy job (#714). docs.yml granted pages: write and id-token: write to the whole workflow. The build job now holds contents: read; deploy gets the two grants the actions/deploy-pages README lists as its minimum.

The crates.io token off the command line (#715). release.yml ran cargo publish --token "$CARGO_REGISTRY_TOKEN". cargo reads that variable from the environment, so the flag only put the token in argv. tests/release/secret-argv.test.sh now fails any workflow that expands a secret-fed variable outside a test -n "${NAME:-}" check, or pastes ${{ secrets.* }} into a script.

Related Issue

Closes #713, closes #714, closes #715. Part of #731.

Validation

Notes for Reviewers

Once this merges I add dco to the main ruleset's required checks and tell the five authors above how to sign off their commits. The docs.yml change gets its real test on the first docs deploy from main, which this merge triggers because the workflow file is in its own paths filter.

🤖 Generated with Claude Code

vladimirrott and others added 3 commits October 29, 2026 04:12
scripts/check_dco.sh reads the non-merge commits in BASE..HEAD and fails
any that lacks a Signed-off-by trailer, as git parses trailers, whose
address matches the commit author's. Dependabot authors as its noreply
address and signs off as support@github.com; the script accepts that one
pairing. A range it cannot resolve, or one holding nothing but merges, is
refused rather than passed. On failure it prints the fetch-by-URL and
`git rebase --signoff` commands, which work from a fork whatever its
remotes are called.

The new `dco` job in ci.yml runs it over each pull request with full
history; the main ruleset will require it once this lands.
tests/release/dco.test.sh builds throwaway repositories for each case,
and eight mutants of the script (tip-only, regex instead of the trailer
parser, case-sensitive match, no empty-range guard, the bot address for
anyone, merges counted, unsigned exiting 0, no ref guard) each fail it.

CONTRIBUTING.md, docs/contributing/CONTRIBUTING.md, the developer guide
and the PR template now say a sign-off is required. The developer guide
also names the seven required checks instead of an out-of-date count.

docs.yml grants pages: write and id-token: write to the deploy job only,
the minimum actions/deploy-pages documents; the build job keeps
contents: read.

Signed-off-by: Vladimir Rotariu <sysknife-development@protonmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
release.yml ran `cargo publish --token "$CARGO_REGISTRY_TOKEN"`, which put
the token in the process's argv, readable through /proc by every process
on the runner. cargo reads CARGO_REGISTRY_TOKEN from the environment, and
the step already exports it, so the flag goes.

tests/release/secret-argv.test.sh parses each workflow, collects the env
variables whose value names `secrets.` at workflow, job and step level,
and fails when a `run:` script expands one outside a `test -n` presence
check, or writes `${{ secrets.* }}` into the script itself. It failed on
the old release.yml. Five mutants of the scanner each fail its fixtures;
a sixth showed an unreachable empty-directory guard, which is removed.

Signed-off-by: Vladimir Rotariu <sysknife-development@protonmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vladimirrott
vladimirrott merged commit a487bae into main Oct 29, 2026
14 checks passed
@vladimirrott
vladimirrott deleted the ci/dco-check branch October 29, 2026 10:48
vladimirrott added a commit that referenced this pull request Oct 29, 2026
#732 removed `--token "$CARGO_REGISTRY_TOKEN"` from the publish step after
jay23606 had the same fix ready in #696 for #694. The entry now says so.

Signed-off-by: Vladimir Rotariu <sysknife-development@protonmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 29, 2026
This was referenced Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant