Repository navigation
ci(release): prefer a decdn.org key from KEYS in sign-release.sh - #2393
Conversation
With DECDN_SIGNING_KEY unset, sign-release.sh now picks the one secret key that has a live @decdn.org uid and is published in KEYS. Two such keys stop the script with both fingerprints listed. With none, it falls back to the first secret key gpg lists, and the KEYS check still rejects an unpublished key. DECDN_SIGNING_KEY keeps priority, and the "==> Signing as" line names the rule that chose the key. The uid match is on the email (inside the last <...>, or a bare address), anchored on @decdn.org, and skips revoked/expired keys and uids. The KEYS keyring is built before key selection, since the new rule reads it. A pytest suite runs the real script against a scratch keyring and KEYS, covering keyring order, ambiguity, fallback, look-alike domains, revoked uids and the DECDN_SIGNING_KEY override. Closes #2391 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The UID parser does not implement the documented last-angle-bracket matching rule when text follows the email.
1 open finding
What changed in this PR
Updates release signing to prefer a published @decdn.org secret key while preserving explicit overrides and fallback behavior.
Changes:
- Adds deterministic signing-key selection and ambiguity handling.
- Adds GPG-backed regression tests.
- Updates release documentation and changelog.
| File | Description |
|---|---|
.github/scripts/sign-release.sh |
Implements key discovery and selection rules. |
.github/scripts/tests/test_sign_release_key_selection.py |
Tests selection, ambiguity, validity, and fallback behavior. |
RELEASING.md |
Documents the new selection order. |
CHANGELOG.md |
Records the release-tooling change. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Addresses the review of the sign-release.sh key selection: - The fallback no longer takes the first secret key gpg lists. It takes the one secret key that can sign and is published in KEYS, and stops with every fingerprint listed when there are none or several. - A key that KEYS marks revoked, expired, invalid or disabled, or that has no usable signing capability, counts as unpublished, even when the local copy still looks live. The final KEYS check uses the same set, so DECDN_SIGNING_KEY is held to it too. - Key listings are captured in assignments, so a gpg failure stops the script with gpg's own error instead of reading as "no key" or "not in KEYS". An empty secret listing gets its own message. - The @decdn.org match takes the email only from a <...> that ends the uid, and otherwise needs a bare address with no spaces or brackets. - Comments describe what the code does: no claim that the fallback is gpg's own choice, gpg.conf's default-key is noted as unread, and the test fixture's socket-path rationale names /run/user/<uid>. Tests now generate keys with an encryption subkey, like the real keys in KEYS. They add cases for key rotation, a revocation published only in KEYS, two @decdn.org uids on one key, a co-maintainer key without its secret, an empty keyring, an injected gpg failure, and the fallback's refusals. A mutation sweep of 11 mutants over the matcher, the validity filters, both ambiguity checks, the KEYS check and the listing error path kills all 11. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The @decdn.org match took the email from a <...> only when it ended the uid, so `Maintainer <[email protected]> (release key)` did not match, although gpg's own `<[email protected]>` lookup finds that uid. gpg takes the FIRST <...> regardless of what follows it, so `Two <[email protected]> <[email protected]>` has the email [email protected] to gpg; the old end-anchored rule read [email protected]. The script now takes the first <...>, matching gpg in both cases. Tests cover a uid with text after the address and a uid with two <...> pairs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Gas snapshotNo gas changes vs base. |
Code Coverage OverviewLanguages: Rust, Solidity Rust / code-coverage/cargo-llvm-covThe overall line coverage in commit e9a2e8a in the Show a line coverage summary of the most impacted files.
Solidity / code-coverage/forgeThe overall line coverage in commit e9a2e8a in the Updated |
Port decdn/decdn#2393. With SPONSORD_SIGNING_KEY unset, sign-release.sh used gpg's first secret key, so a maintainer keyring whose personal key sorts first died at the KEYS check (as v0.0.1's signing did). It now picks the one secret key that can sign, has a live @decdn.org uid and is published in KEYS, else the one published secret key whatever its uids. Two or more candidates at either step stop the script with every fingerprint listed. A key KEYS marks revoked or expired counts as unpublished, gpg failures while listing keys are reported instead of reading as "no key", and "==> Signing as" names the rule that chose the key. SPONSORD_SIGNING_KEY keeps priority. The KEYS keyring is now built before key selection, which reads it. The pytest suite from decdn runs the real script against a scratch keyring. Co-authored-by: Claude Opus 5.5 <[email protected]>
Port decdn/decdn#2393. With SPONSORD_SIGNING_KEY unset, sign-release.sh used gpg's first secret key, so a maintainer keyring whose personal key sorts first died at the KEYS check (as v0.0.1's signing did). It now picks the one secret key that can sign, has a live @decdn.org uid and is published in KEYS, else the one published secret key whatever its uids. Two or more candidates at either step stop the script with every fingerprint listed. A key KEYS marks revoked or expired counts as unpublished, gpg failures while listing keys are reported instead of reading as "no key", and "==> Signing as" names the rule that chose the key. SPONSORD_SIGNING_KEY keeps priority. The KEYS keyring is now built before key selection, which reads it. The pytest suite from decdn runs the real script against a scratch keyring. Co-authored-by: Claude Opus 5.5 <[email protected]>

What
With
DECDN_SIGNING_KEYunset,sign-release.shresolves the signing key in this order:@decdn.orgkey. Use the one secret key that can sign, has a live@decdn.orguid, and is published inKEYS.KEYS, whatever its uids.DECDN_SIGNING_KEYstill takes priority. The==> Signing as <fpr> (<rule>)line names the rule that chose the key, so you see the choice before the passphrase prompt.Closes #2391
Reviewer notes
@decdn.org-key case should take "gpg's default key" as before. The review showed that this lets keyring order choose between two published keys, for example during key rotation. I updated AC3 in the issue to match.KEYSlists it, does not mark it revoked, expired, invalid or disabled (field 2r/e/i/d), and shows it can sign (Sin field 12). It isKEYS's view that counts, not the local keyring's: a revocation published inKEYSbut never imported locally still excludes the key. The final KEYS check uses the same set, so it holdsDECDN_SIGNING_KEYto this rule too.<address>lookup uses: the text inside the uid's first<…>, whatever follows it, or else the whole uid as a bare address. The match is case-insensitive and anchored.Maintainer <[email protected]> (release key)matches. These do not match:decdn.org.example,notdecdn.org,eu.decdn.org,Name [email protected], andTwo <[email protected]> <[email protected]>.default-keyis not read. gpg.conf'sdefault-keyis ignored, as it was before. The header and RELEASING.md now say so.publish-crates.shis out of scope, as the issue says.Verification
pytest .github/scripts/tests -q: 169 passed, 27 of them new.KEYS.@decdn.orgkeys@decdn.orguidsKEYSDECDN_SIGNING_KEYpathshellcheck .github/scripts/sign-release.sh: clean.[email protected]), against the already publishedv0.0.1. It printed==> Signing as DA75…AADB (decdn.org key from KEYS), verified the tag, then stopped at "already published", as expected.pre-commiton the changed files: passed.CHANGELOG.mdentry added🤖 Generated with Claude Code