Skip to content

fix: use constant-time comparison for registry pubkey check (PILOT-93)#3

Open
matthew-pilot wants to merge 1 commit into
mainfrom
openclaw/pilot-93-20260528-053400
Open

fix: use constant-time comparison for registry pubkey check (PILOT-93)#3
matthew-pilot wants to merge 1 commit into
mainfrom
openclaw/pilot-93-20260528-053400

Conversation

@matthew-pilot
Copy link
Copy Markdown
Collaborator

Summary

Replace Go string != operator with subtle.ConstantTimeCompare for registry-bound public key comparison in handshake.go.

Details

  • File: handshake.go:497
  • Change: regPubKey != msg.PublicKeysubtle.ConstantTimeCompare([]byte(regPubKey), []byte(msg.PublicKey)) != 1
  • Added crypto/subtle import

Rationale

Go's string != operator has early-exit byte comparison, which leaks timing information about the registry-bound pubkey. While both values are public information (the pubkey is public by design), constant-time comparison is a hygiene best practice that silences recurring audit findings.

Verification

  • go build ./... — passes
  • go vet ./... — passes
  • go test ./... — all tests pass (10.6s)

Jira: PILOT-93

Replace Go string != operator (early-exit byte comparison) with
subtle.ConstantTimeCompare for the registry-bound public key check
at handshake.go:498. While the timing leak is mostly theoretical
(both values are public information), constant-time comparison is
hygiene best practice and silences recurring audit findings.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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