server: accept P2P peers over WebTransport - #2582
Draft
sputn1ck wants to merge 4 commits into
Draft
Conversation
|
Ok |
Jason-123-cyber
approved these changes
Aug 11, 2026
|
hi @sputn1ck @Jason-123-cyber i am a security researcher, I identified critical issues in your code that would lead to fund loss. I want to ask: is your bug bounty still active, and are there rewards for valid vulnerabilities? Your response is most appreciated |
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.
Change Description
Browsers cannot open Bitcoin's raw TCP peer-to-peer transport. This change adds
an optional WebTransport listener so browser clients can exchange the existing
Bitcoin P2P byte stream with btcd over HTTP/3 and QUIC.
Each accepted WebTransport session carries exactly one client-opened,
bidirectional stream. The listener exposes that stream as a
net.Connandfeeds it into btcd's existing peer server; it adds no Bitcoin framing or
protocol changes.
The new configuration is opt-in:
--webtransportlistenbinds a UDP listener.--webtransportcertand--webtransportkeyconfigure its TLS certificate.--webtransportpathselects the exact HTTPS endpoint.--webtransportoriginflags extend the same-origin browserpolicy with exact origins. The exact value
*accepts any valid HTTP(S)browser origin.
--notcplistenallows a WebTransport-only server. Without it, the regularTCP listener continues to operate.
The wildcard remains fail-closed for malformed, duplicate, opaque
null, andnon-HTTP(S) origins. Partial patterns such as
https://*.example.comremaininvalid. Allowing every HTTP(S) origin lets any website ask a visitor's browser
to connect to the node and consume peer slots and bandwidth, so it requires an
explicit
--webtransportorigin='*'. Origin policy is not clientauthentication; non-browser clients can omit the header.
The listener bounds pending QUIC connections and upgraded sessions, applies
request and first-stream deadlines, rejects additional streams, and closes the
HTTP/3 connection with its btcd peer. Defaults remain unchanged when no
WebTransport listener is configured.
The paired Neutrino change supplies the browser client and a complete
ChainServicesynchronization test:lightninglabs/neutrino#381
The commits are ordered for review:
integration proof.
errcheckfindings found during thefinal branch lint pass.
Steps to Test
Run the native unit, race, vet, and branch-diff lint checks:
Run the stock-browser integration test:
The browser test builds the real Go/WASM peer, serves it from a different
HTTP origin, starts a full native btcd simnet node with
--webtransportorigin=*, pins a short-lived P-256 certificate by SHA-256 hash,and verifies
version/sendaddrv2/verackplus ping/pong. btcd's RPC view mustreport the same client as inbound on the WebTransport listener.
Pull Request Checklist
Testing
applicable: this is a new opt-in transport.)
Code Style and Documentation
📝 Please see our Contribution Guidelines for further guidance.