fix(metadata): reject ed25519 public keys with invalid length#739
Open
kanywst wants to merge 1 commit into
Open
fix(metadata): reject ed25519 public keys with invalid length#739kanywst wants to merge 1 commit into
kanywst wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds validation to reject malformed Ed25519 public keys early (preventing downstream panics) and introduces regression tests covering invalid-length keys.
Changes:
- Add Ed25519 public key length check in
Key.ToPublicKey(). - Add a unit test that verifies invalid-length Ed25519 keys are rejected and do not trigger panics through
VerifyDelegate.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| metadata/metadata_test.go | Adds a test ensuring invalid-length Ed25519 public keys error and don’t panic in delegate verification. |
| metadata/keys.go | Rejects non-32-byte Ed25519 public keys in ToPublicKey() to avoid later panics in verification. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
crypto/ed25519.Verify panics when the public key length is not ed25519.PublicKeySize, so a malformed ed25519 key in root or delegated metadata panicked VerifyDelegate instead of returning an error. Validate the length on decode, matching the panic-to-error change for Key.ID() in theupdateframework#713. Adds a regression test. Signed-off-by: kanywst <niwatakuma@icloud.com>
kanywst
force-pushed
the
fix/ed25519-key-length-validation
branch
from
June 11, 2026 15:11
11c11d9 to
b69fc50
Compare
rdimitrov
approved these changes
Jun 25, 2026
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.
ToPublicKeyaccepts an ed25519 public key of any length.crypto/ed25519.Verifypanics when the length is noted25519.PublicKeySize, so a malformed ed25519 key in root or delegated metadata panicsVerifyDelegateinstead of returning an error.Repro against abd8cd2:
Also reachable via
updater.New(trusted root) andGetTargetInfo(a delegated role'sdelegations.keys).Same panic-to-error case as #713 (
Key.ID()), which did not coverToPublicKey. Low severity: needs a malformed key that reaches verification, and affects availability only, not signature validity.Includes a regression test.