contrib: require trusted signers in verify.py

bitcoin/bitcoin: PR #36965

3 suggestions

Optional improvements

Link

[suggestion] · Revoked signatures receive ineffective trust advice

Revoked signatures receive trust advice that cannot make them eligible and no warning on success; the warning omission predates this PR, but separate reporting would clarify the new exclusion.

Location: contrib/verify-binaries/verify.py:409 (head).

Details and suggested fix

good_untrusted includes signatures marked revoked, even if their keys are already trusted or explicitly listed. When the threshold fails, the diagnostic recommends trusting these keys in GPG or passing fingerprints through --trusted-keys, although neither action can override the revocation filter. On success, they appear only in an info-level GOOD SIGNATURE (untrusted) message. Its representation includes status='revoked', but -q hides it, and only expired keys receive a status warning. Report revoked signatures separately, state that they cannot count on failure, and emit a warning on success. Keep the trust advice for non-revoked untrusted signatures; verification decisions need not change.


Link

[suggestion] · test.py integration cases now require three locally trusted signers

With default settings, manual test.py integration cases now fail for keyrings with one or two trusted 22.0 signers that could pass before; this follows from source inspection, not an observed test run.

Location: contrib/verify-binaries/test.py:89 (head).

Details and suggested fix

The success cases still invoke verify.py --json pub 22.0... without --trusted-keys. Given at least three verifiable builder signatures, the base counted them all toward the threshold and needed only one trusted signer to satisfy the test's nonempty good_trusted_sigs assertion. Head requires three distinct non-revoked trusted signers, so the same setup with only one or two is rejected. Zero-trusted setups already failed the base assertion. Pass full primary fingerprints of at least three known 22.0 signers through --trusted-keys in these success cases so they no longer depend on the developer's trustdb. The documented python3 -m unittest contrib/verify-binaries/test.py command runs only the mocked unit tests, not these integration cases in main().


Link

[suggestion] · Unit tests never mix trusted and untrusted signers

The current counting logic is correct, but the new tests would miss a regression that lets untrusted signatures fill a quorum shortfall whenever at least one trusted signer exists.

Location: contrib/verify-binaries/test.py:36 (head).

Details and suggested fix

check_signatures gives every signature the same GPG trust, and each existing --trusted-keys list matches either all signers or none. Consequently, adding len(good_untrusted) to the count only when trusted_signers is nonempty would leave every new assertion satisfied: zero-trusted cases still fail, while the trusted and deduplication cases have no untrusted signatures to add. Add a threshold-three case with one trusted and two untrusted signers expecting NOT_ENOUGH_GOOD_SIGS; the existing helper can express this by explicitly trusting only one primary fingerprint. Also cover success with three trusted signers and one untrusted signer, checking that the latter is returned in good_untrusted.


Coverage details

Background

Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.

Documented decisions

Historical verification was an explicit compatibility concern when narrowing quorum eligibility. In a separate proposal, participants distinguished revoked keys from expired keys: expiration need not imply compromise, and excluding expired keys could prevent verification of old releases. The author subsequently added an option to count expired signatures while keeping revoked signatures excluded.

The pinned change excludes revoked signatures from the trusted threshold while leaving expired signatures eligible. This history explains why expiration and revocation have been treated differently, but does not establish the intended primary-key counting unit or imply that the separate proposal is present in the pinned code.

Source 1 · Source 2 · Source 3

Ralph's inferences

The pre-existing documentation describes a plurality of user-selected trusted public keys, not merely possession of enough cryptographically valid signatures. It tells users to decide which builder keys they trust and documents a threshold of trusted signatures using full fingerprints. This supports interpreting the threshold as multiple trusted attestations, but does not prove an explicit original requirement to deduplicate by primary key—or establish independence between people controlling different keys.

This distinction matters because the base implementation counted trusted and untrusted signatures together, whereas the head counts trusted identities deduplicated by primary fingerprint. The documentation supports the trust-policy aspect more directly than the precise deduplication rule.

The existing interface exposes two trust inputs: local GPG state and explicitly supplied keys. Its README demonstrates full 40-character fingerprints, while the base implementation matches the identifier recorded from signature status. The head retains that identifier-matching path, adds signing and primary fingerprints, and falls back to the existing identifier when a primary fingerprint is unavailable. These are observable compatibility accommodations, not independently documented historical requirements.

Fingerprint recognition and the threshold's counting identity are separate decisions: the head can recognize an explicitly trusted signing subkey while counting its primary key once. Preserving identifier matching and fallback also distinguishes this change from requiring every existing invocation or GPG status stream to supply a primary fingerprint.