Skip to content

fix: guard nonce slice bounds to prevent panic on short nonce string#127

Open
antojoseph wants to merge 1 commit into
masterfrom
security/f023-nonce-slice-panic
Open

fix: guard nonce slice bounds to prevent panic on short nonce string#127
antojoseph wants to merge 1 commit into
masterfrom
security/f023-nonce-slice-panic

Conversation

@antojoseph
Copy link
Copy Markdown

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 received

Security 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/...
  • Send a registration message with an empty nonce and verify the coordinator handles it gracefully

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.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
d-inference Ready Ready Preview May 4, 2026 2:49am
d-inference-console-ui-dev Ready Ready Preview May 4, 2026 2:49am
d-inference-landing Ready Ready Preview May 4, 2026 2:49am

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant