pgpverify-maven-plugin provides a mechanism for verifying (un)signed maven artifacts using a map of PGP public keys. This is a public repository of PGP public key fingerprints as discovered in the public Maven repository.
The keysmap repository is constructed in such a way that multiple builds produce the byte-exact same pgp-keys.map file.
Trust by consensus: builds from multiple independent locations do indeed produce the exact same pgp-keys.map file. As part of certifying the content, one needs only to provide his signature (as a sign of approval) of a local build. Once sufficient signatures are committed, an automated CI build performs the same operations and should be able to validate pgp-keys.map with all given signatures.
Mechanism:
- Check out
keysmaprepository locally, a specific branch if preparing for new release. - Run
make validate. The validation itself may fail if insufficient signatures are available at present time. - Sign generated
pgp-keys.map:gpg -a --detach-sign -o "signatures/your-name.asc" pgp-keys.map - Create PR containing
signatures/your-signature.asc
Properties:
artifacts.txt: source list of artifacts to include in the keysmap.artifact-metadata: source of (downloaded) metadata. Persisting this data locally ensures that there is a stable set of input data, ensuring reproducibility.artifact-signatures: signatures of all artifact versions, downloaded from the Maven repository.
It is assumed that signatures do not disappear over time, hence will not affect reproducibility.keyring: the local PGP keystore in which downloaded public keys are stored.
It is assumed that public keys do not disappear over time, hence will not affect reproducibility.
Validate pgp-keys.map by generating the file and validating it using all signatures that can be found in signatures.
git submodule init
git submodule update
make validate
make validate may fail in case an insufficient number of signatures is found.
Plan for PGP keys map maintenance/validation: trust based on consensus of independent parties generating and signing the byte-exact pgp-keys.map.
/- pgp-public-keys-cache --\
artifact-list --> artifact-metadata-cache --> artifact-signatures --> pgp-keys.map --> validate
Foundational:
MakefileThe build instructions that lead up to a validateablepgp-keys.mapfile.toolsThe various build tools used.artifacts.txtThe base list of artifacts to include inpgp-keys.map.pgp-keys-manual.txtThe manual entries to include inpgp-keys.map, typically due to missing maven metadata.pgp-keys-overrides.txtThe overrides that are prepended in the resultingpgp-keys.map. These overrides may contain all of keysmap line format, may overlap with generated entries, and are not included in the canonicalization process.
Generated:
artifact-metadataDirectory containing metadata for artifacts listed inartifacts.txt.checksumThe SHA-256 checksum forartifacts.txtwhich allows efficient checking of the source to determine whether or not redownloading is necessary.
artifact-signaturesDirectory containing signatures for all versions of all artifacts inartifacts.txt, derived from artifact metadata inartifact-metadata.checksumThe SHA-256 checksum for the contents ofartifact-metadatato determine whether we should refresh signature files. (sha256sum -b artifact-metadata/* | sha256sum -b -)
pgp-keys-generated.txtThe public key entries generated usingartifact-signatures.keyring.kbx(keyring.kbx~as backup file) The PGP public keys that were downloaded as necessary fromartifact-signaturesGPG signatures.
Result:
pgp-keys.mapThe resulting artifact - public-key mapping for maven artifacts.signaturesThe validation signatures submitted by reviewers.
- Check both key servers: hkps://keyserver.ubuntu.com hkps://subkeys.openpgp.net (or whatever the exact address is, check with pgpverify-maven-plugin)
- Check and respect revocations of public keys.
- Canonicalize
pgp-keys.map:- Assumption: groupID may be shared by multiple independent developers (
org.apache.maven.plugins,org.codehaus.mojo) therefore we cannot blindly group multiple signatures under one groupID. - Reduction: version range for all artifacts with subsequent version that use the same fingerprint.
- Reduction: artifactID-wildcard if (all versions of) all artifacts of a single group use the same fingerprint.
This may hold for wild-carded version specifier, or version-range specifier, or specific version, as long as this holds for all artifacts. - Add final entries in list for undefined version of artifact with fingerprint used in most recent version to facilitate future versions.
- Assumption: groupID may be shared by multiple independent developers (
- Add ability to verify downloaded signatures against the actual artifacts.
- Currently assumes
jar-type artifact. Check if this is an issue in cases with different packaging such aswar,ear, etc.
If needed to be discovered, downloadpomartifact first. Read packaging type from thepomartifact, then download the appropriate signature file. - Consider switching to downloading the tools (with
go install ...or so) instead of building from submodule. - Should we do someting with revocations as downloaded from keyserver using
gpg --refresh-keys? Is there any sense in signaling that in keysmap and warning during verification process?