contrib: require trusted signers in verify.py

bitcoin/bitcoin: PR #36965

5 suggestions

Optional improvements

Link

[suggestion] · --trusted-keys silently accepts long key IDs as quorum trust

Inherited --trusted-keys key-ID matching now gates quorum eligibility without warning that a 16-hex entry identifies a key by only 64 bits rather than its full fingerprint.

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

Details and suggested fix

is_trusted_sig accepts sig.key as well as the fingerprints parsed from VALIDSIG. Consequently, a 16-hex entry can make a signer count even when neither full fingerprint matches the supplied entry. The existing test_inactive_signature_quorum fixture relies on this interface, but the README describes independently verified full fingerprints. This is not a regression from base, which counted untrusted good signatures too, and it does not establish a practical key-ID preimage attack. If key-ID compatibility is intentional, retain it but warn on key-ID entries and document the weaker matching.


Link

[suggestion] · The --trusted-keys failure hint omits independent verification

The failure hint can encourage trusting the listed fingerprints without an independent check; the risk depends on users copying them into --trusted-keys.

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

Details and suggested fix

When quorum is missed, the hint suggests passing full fingerprints through --trusted-keys and then lists each untrusted signer's fingerprint and user ID. These values identify signers of the supplied signature file, not builders the user has independently chosen to trust. They can also include keys fetched after an --import-keys prompt. Apply the README's caveat directly to this recovery instruction: tell users to check fingerprints against the guix.sigs builder keys or another independent source before trusting them, rather than trusting them solely because they appear in this output.


Link

[suggestion] · Manual network checks in test.py now need three trusted signers

With default configuration, the manual network tests now require three distinct GPG-trusted 22.0 signers instead of one; source inspection shows that previously sufficient keyrings no longer satisfy their success expectations.

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

Details and suggested fix

Both 22.0 success checks invoke verify.py without --trusted-keys or a threshold override and inherit the caller's GPG keyring. A keyring with at least three active good signatures but only one or two trusted signers could pass before, including the nonempty good_trusted_sigs assertion. It now misses the default trusted-signer threshold. The verifier returns code 9 without JSON, so the script's preceding json.loads call can raise before the exit-code assertion. Document the three-trusted-signer prerequisite beside these manual checks. This failure is inferred from source, not an observed network-test run.


Link

[suggestion] · The advertised unittest command skips test_inactive_signature_quorum

python3 -m unittest contrib/verify-binaries/test.py -v discovers the new TestCase but omits the existing revocation-ordering and expiry-option checks.

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

Details and suggested fix

test_inactive_signature_quorum remains a plain module-level function, so the default unittest loader does not collect it. Only main() calls it, and that entry point proceeds into network-dependent release checks. The omitted function checks KEYREVOKED precedence in both status orderings, the BINVERIFY_ALLOW_EXPIRED environment/flag matrix, and quorum counts with active, expired and revoked signatures. Add a method in SignatureTrustTests that calls this function, and let main() run it through the suite instead of calling it separately. Both entry points would then include these offline assertions.


Link

[suggestion] · Trust tests omit a partially trusted quorum

The offline fixtures never mix trusted and untrusted distinct signers, so they do not check whether untrusted signatures can top up a partially trusted quorum.

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

Details and suggested fix

The three-primary fixtures trust all identities or none, and test_inactive_signature_quorum explicitly trusts every key. Also, the empty-list assertions after NOT_ENOUGH_GOOD_SIGS do not establish classification: that return path always clears both lists. The current quorum filter correctly excludes untrusted signatures. Add a case trusting only two of three distinct primaries and require rejection at a threshold of three. Also add a successful case with three trusted primaries and one additional untrusted signer, asserting the expected contents of both returned lists.


Coverage details

Background

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

Ralph's inferences

The documented security model is user-selected confidence in release signers, rather than mere possession of their public keys. The base README asks users to decide which builder keys they trust and describes a threshold of trusted signatures using local GPG state plus manually specified keys. This supports interpreting quorum as endorsements from chosen identities, although it does not explicitly define primary-key deduplication.

This is the strongest inspected evidence for the intended relationship between --min-good-sigs and --trusted-keys. However, the base implementation totals both good_trusted and good_untrusted, while the base option help asks only for 'good signatures'; the inspected record therefore contains a documentation/behavior tension whose original resolution remains unverified.

The verifier distinguished cryptographic signature validity from confidence in the signer. It classified GOODSIG as good independently of trust, interpreted TRUST_MARGINAL, TRUST_FULLY, and TRUST_ULTIMATE as trusted, and interpreted TRUST_UNDEFINED and TRUST_NEVER as untrusted. Explicit --trusted-keys membership provided a separate application-level route to trust, described as not 'trust' in the GPG sense.

The trust contract was not simply 'imported key equals trusted signer,' nor was it limited to GPG FULLY or ULTIMATE status. The head retains this status mapping while making the resulting trust classification determine quorum eligibility. These observations establish the verifier's reliance on GnuPG's classification, but not that classification's underlying identity-assurance guarantees.

The base exposed two different identifier contracts: its README demonstrated full 40-character fingerprints, whereas its parser retained the identifier supplied by GOODSIG and matched --trusted-keys against that value exactly. It did not consume VALIDSIG fingerprints or represent the relationship between signing subkeys and primary keys.

Compatibility with key identifiers preserves an existing matching interface, while primary- and signing-key fingerprints address the documented fingerprint interface. The inspected base cannot establish that its identifier matching supplied a full-fingerprint identity guarantee or that multiple signing subkeys represented one quorum identity.

Independent endorsements are a plausible purpose of a trusted-signature threshold, but the inspected base counted signature records rather than distinct primary-key identities. Even primary-key deduplication establishes distinct keys, not necessarily independently controlled people or organizations.

The head explicitly groups countable signatures by primary fingerprint, falling back to the recorded key identifier. This makes the identity unit materially more explicit than in the base. Historical evidence retrieved here is insufficient to call that precise identity unit an established original requirement or to claim that GnuPG trust alone guarantees signer independence.