Repository navigation
Fix eight findings in registry verification with root keys - #286
Merged
Merged
Conversation
ericmj
force-pushed
the
registry-verification-fixes
branch
from
December 3, 2026 23:37
8fc1e71 to
672e438
Compare
update_key_lists/3 treated stored lists below `min_version` as absent, so `revoked` was always `false` for them. A client release that raises `min_version` after an intermediate key is revoked then kept the registry files cached under that key. The keys of those stored lists now count for `revoked`. The lists still don't count for the rollback checks.
update_key_lists/3 compared versions before it checked the root signatures of the fetched intermediate key list, so a list that nobody signed returned `key_list_rollback` or `key_list_conflict`. It returns `untrusted_key_list`.
A later intermediate key list that left out a revoked root key, or listed it as usable, made a client trust the key again. A client with stored lists now rejects such a list. The stored list counts for this also when it is below `min_version`. Only root keys that the client is configured with count.
…pire check_freshness/4 accepted any expiry below 2^63, so one freshness signature with a far expiry kept its payload accepted until the freshness key was revoked. An entry that expires more than 60 days from now doesn't count, which is the longest a signing key list can be valid. The intermediate key list had no limit. It can expire at most 400 days from now.
hex_repo removed a `x-hex-payload-hash` header that the repository sends from a `200` only, so a caller that reads the header from a `304` got the server's value.
Keys are compared by their bytes, and a compressed-point encoding of a key counted as another key: two signers from one private key, and a revocation that didn't match the configured key. A key is accepted as DER with a named curve and the uncompressed point only, and an intermediate key list is rejected when a root key that names an ECDSA algorithm isn't in that encoding.
The single public key path raised on a `Signed` message without
`signature` and on one that can't be decoded. Both return
`{error, bad_signature}`.
The limit of 16 signature entries was checked after the protobuf decode, so 16 MiB of empty entries, 16 KB compressed, made the decoder build millions of terms before the message was rejected. The entries are counted on the encoded message first. The payload of a key list is decoded before its signatures are verified, so a key list file is at most 64 KiB uncompressed. Fixes #281
ericmj
force-pushed
the
registry-verification-fixes
branch
from
December 3, 2026 23:38
672e438 to
9f3178f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Eight fixes to the registry verification with root keys, one per commit. None of this code is in a hex_core release.
min_versionafter an intermediate key was revoked kept the registry files cached under that key, because stored lists belowmin_versioncounted as absent andrevokedwasfalse. Their keys now count forrevoked.key_list_rollbackorkey_list_conflict, becauseupdate_key_lists/3compared versions first. The root signatures are checked first and the list returnsuntrusted_key_list.min_version. Only configured root keys count.hex_repopassed a server-sentx-hex-payload-hashthrough on a304.{error, bad_signature}.The specification change is hexpm/specifications#106.