Harden WebSocket handshake and frame handling - #1846
Conversation
johnny9
left a comment
There was a problem hiding this comment.
Reviewed exact head 4103bfd. I did not find a correctness defect in the changed handshake/frame logic. The remaining issue is incomplete boundary coverage for the new Origin/Host policy. The proposed test-only patch applies cleanly and the full ESP32-S3 QEMU suite remains green: 76 tests, 0 failures.
4103bfd to
40161f9
Compare
|
Physical Bitaxe 602 smoke test passed on head The application-only OTA reported the expected firmware version, the device returned to healthy mining with three stable API samples, zero fault indication, and the configured pool intact. An independent authorized Stratum V1 probe received a fresh Full test result and artifacts: https://mining-qa-status.vercel.app/results/c9de3189-270a-428f-95c2-2e254f1dda70 Test harness: |
b4b747f to
0db611e
Compare
Add unit tests for websocket hardening
Summary
Harden the WebSocket receive and handshake paths before a client is accepted.
Originto matchHost, while preserving origin-less CLI clients.Why
Previously, rejection happened after the HTTP upgrade and ignored application frames caused peer-sized heap allocation. This change makes both paths fail closed without changing the trusted-network model or adding authentication.
Review follow-up
Incorporates @johnny9's requested coverage for case-insensitive schemes, bracketed IPv6, query/fragment suffixes, malformed ports, empty authority/Host, and absent schemes.
The branch is rebased onto the ESP-IDF 6 upgrade on
master, retaining upstream's pre/post-handshake lifecycle.Stack and related work
First in the cumulative HTTP hardening series; #1847 and #1848 build on it. Related to #1845, with this draft additionally covering pre-handshake same-origin and race-safe capacity checks.
Validation
git diff --check