fix(web): harden WebSocket and net host boundaries
- WS handshake: same-origin CheckOrigin instead of allow-all
- route_ws require_auth/需要登录: broadcast/room need a session by default,
explicit opt-out for public feeds; unauthenticated handshakes get 401
- WS limits: 1 MiB per message, 256 replies per connect; transport errors
return {ok:false, error} instead of an empty success; empty rooms GC'd
- net host: enforce the 8 MiB response cap while reading (incl. error and
SSE error paths) so a peer cannot exhaust memory
- url_encode: %20 for space (URL segment semantics, not form +)
- docs: sync 网页 (route_ws 需要登录, connect caps) and CHANGELOG
- tests: gold expectations, live fixture opt-out, hub GC, ws auth gate
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
8e23a5395a
commit
86b183e2d7
15 files changed
+233
-28
No files matched your search
@@ -16,5 +16,5 @@ import sys:lib/sys.mq.md
|
||||
**pg = > web.page title="ws-live"**
|
||||
**app = > web.app page=`pg` port=18112**
|
||||
**app = > `app`.configure access_log=True**
|
||||
**app = > `app`.route_ws path="/room" mode="broadcast"**
|
||||
**app = > `app`.route_ws path="/room" mode="broadcast" require_auth=False**
|
||||
> `app`.listen
|
||||
+1
-1
@@ -3735,7 +3735,7 @@ callable-ok",
|
||||
|
||||
#[test]
|
||||
fn lib_net_encode() {
|
||||
assert_out("tests/lib/net-encode.mq.md", "a+b");
|
||||
assert_out("tests/lib/net-encode.mq.md", "a%20b");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user