Files
aptly/pgp/internal_test.go
T
Daniel Pinder 59ff63de62 pgp: accept multi-signed releases when the keyring holds only some signers
Debian co-signs each suite's InRelease with more than one archive key, so
gpgv reports a good signature from the key you trust and NO_PUBKEY for the
others, exiting 2. Both verifiers treat that as failure, which means
mirroring Debian requires importing every key Debian happens to sign with.
apt does not require this: it is fatal only when there is no good signature
or a BADSIG.

Adopt that rule for unknown signers. When gpgv exits non-zero the status
stream is parsed per NEWSIG block and the result is a success only when the
process exited, at least one block is a good signature from a held key, at
least one block is an unknown issuer (ERRSIG reason 9 with NO_PUBKEY), and
nothing else appears. BADSIG, EXPSIG, EXPKEYSIG and REVKEYSIG from a held
key still fail, as does any unexplained failure. The exit-zero path is
unchanged.

KEYEXPIRED and KEYREVOKED are deliberately not disqualifiers: doc/DETAILS
notes KEYEXPIRED is emitted for an expired subkey even when that subkey was
not used, so treating it as a verdict rejects valid signatures.

checkDetachedSignature gets the equivalent change for the internal verifier.
2026-11-01 13:26:36 +01:00

49 lines
1.3 KiB
Go

package pgp
import (
. "gopkg.in/check.v1"
)
type GoVerifierSuite struct {
VerifierSuite
}
var _ = Suite(&GoVerifierSuite{})
func (s *GoVerifierSuite) SetUpTest(c *C) {
s.verifier = &GoVerifier{}
s.verifier.AddKeyring("./trusted.gpg")
s.multisigOneVerifier = &GoVerifier{}
s.multisigOneVerifier.AddKeyring("./multisig-one.gpg")
s.multisigBothVerifier = &GoVerifier{}
s.multisigBothVerifier.AddKeyring("./multisig-both.gpg")
c.Assert(s.verifier.InitKeyring(false), IsNil)
c.Assert(s.multisigOneVerifier.InitKeyring(false), IsNil)
c.Assert(s.multisigBothVerifier.InitKeyring(false), IsNil)
}
type GoSignerSuite struct {
SignerSuite
}
var _ = Suite(&GoSignerSuite{})
func (s *GoSignerSuite) SetUpTest(c *C) {
s.keyringNoPassphrase = [2]string{"../system/files/aptly.pub", "../system/files/aptly.sec"}
s.keyringPassphrase = [2]string{"../system/files/aptly_passphrase.pub", "../system/files/aptly_passphrase.sec"}
s.passphraseKey = "F30E8CB9CDDE2AF8"
s.noPassphraseKey = "21DBB89C16DB3E6D"
s.signer = &GoSigner{}
s.signer.SetBatch(true)
s.verifier = &GoVerifier{}
s.verifier.AddKeyring("../system/files/aptly.pub")
s.verifier.AddKeyring("../system/files/aptly_passphrase.pub")
c.Assert(s.verifier.InitKeyring(false), IsNil)
s.SignerSuite.SetUpTest(c)
}