Repository navigation
guard nil issuer key id on v2 message read path - #319
Merged
Merged
Conversation
twiss
reviewed
Aug 13, 2026
Comment on lines
341
to
353
Collaborator
There was a problem hiding this comment.
Nit: it might be clearer to move the check as close as possible to the usage.
Suggested change
| invalidV3 := sc.OPSVersion == 3 && correspondingSig.Version == 6 | |
| invalidV6 := sc.OPSVersion == 6 && | |
| (correspondingSig.Version != 6 || | |
| !bytes.Equal(sc.IssuerFingerprint, correspondingSig.IssuerFingerprint) || | |
| !bytes.Equal(sc.Salt, correspondingSig.Salt())) | |
| return !invalidV3 && !invalidV6 && | |
| sc.SigType == correspondingSig.SigType && | |
| sc.HashAlgorithm == correspondingSig.Hash && | |
| sc.PubKeyAlgo == correspondingSig.PubKeyAlgo && | |
| correspondingSig.IssuerKeyId != nil && | |
| sc.IssuerKeyId == *correspondingSig.IssuerKeyId |
knQzx
force-pushed
the
guard-nil-issuer-v2-read
branch
from
August 13, 2026 16:27
b1ba59f to
6f7c01a
Compare
Contributor
Author
|
thanks, applied. moved the nil check into the return chain right before the deref instead of the early return |
twiss
force-pushed
the
guard-nil-issuer-v2-read
branch
from
August 14, 2026 09:26
365a80f to
1f99f3d
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.
A signature packet with no issuer key id causes a nil pointer dereference while reading a v2 message, so untrusted input can panic the reader. This checks the issuer key id before it is dereferenced and rejects the signature instead of panicking.