Skip to content

fix: bound REALITY handshakes and preserve JLS verification - #3

Merged
Nemu-x merged 2 commits into
devfrom
fix/reality-preauth-guards
Oct 20, 2026
Merged

Nemu-x merged 2 commits into
devfrom
fix/reality-preauth-guards

Conversation

@Nemu-x

@Nemu-x Nemu-x commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Bounds REALITY's pre-authentication work while preserving long-lived fallback traffic. RealityConfig.HandshakeTimeout defaults to 15 seconds and is lifted after successful authentication/handshake or fallback selection. Pending client and target sockets close on timeout or context cancellation, and mirror connections forward deadline calls.

Also addresses the related audit findings:

  • Stop the final unmetered fallback read exactly at AfterBytes.
  • Omit AuthKey and short ID from debug logs.
  • Cache the parsed X25519 private key and reuse the 17 KiB target buffers. The asynchronous target reader retains ownership of its buffer until it exits.
  • Run application VerifyPeerCertificate and VerifyConnection callbacks after JLS authentication; rejection still fails the handshake.

Validation:

  • Linux Go 1.26.9: full go test -race -count=1 -timeout 10m ./... passed.
  • Linux Go 1.20: full go test -count=1 -timeout 10m ./... passed.
  • Regression tests cover silent clients, cancellation, fallback surviving beyond the handshake timeout, mirror deadlines, threshold accounting, key rotation/cloning, log redaction and rejecting JLS verifier callbacks.
  • Sequential Linux X25519 microbenchmark, three runs: uncached 46.7–47.3 us / 320 B / 7 allocations; cached 23.0–24.3 us / 128 B / 3 allocations. This measures the key-agreement operation, not end-to-end VPN throughput.

No protocol format or module-path changes. No release tags are created.

@Nemu-x
Nemu-x merged commit 32502cb into dev Oct 20, 2026
4 checks passed
@Nemu-x
Nemu-x deleted the fix/reality-preauth-guards branch October 20, 2026 17:35
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