fix: guard nonce slice bounds to prevent panic on short nonce string#127
Open
antojoseph wants to merge 1 commit into
Open
fix: guard nonce slice bounds to prevent panic on short nonce string#127antojoseph wants to merge 1 commit into
antojoseph wants to merge 1 commit into
Conversation
msg.Nonce[:8] panics with a slice-bounds-out-of-range error if a registered provider sends an attestation response with a nonce shorter than 8 bytes. This allows any connected provider to crash the coordinator WebSocket handler. Use a length-guarded truncation instead.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
coordinator/internal/api/provider.go: added a length check before truncating the nonce for logging —if len(nonce) > 8 { nonce = nonce[:8] }— to prevent a slice-bounds panic when a short or empty nonce is receivedSecurity impact
A malicious provider (or fuzzer) could send an empty or single-character nonce string. The previous unconditional
nonce[:8]slice would panic with an index-out-of-range, crashing the coordinator goroutine and enabling a denial-of-service via any connected provider WebSocket.Test plan
go test ./internal/api/...