Skip to content

Fix 2250 - #2255

Merged
oberstet merged 3 commits into
crossbario:masterfrom
oberstet:fix_2250
Jul 15, 2026
Merged

Fix 2250#2255
oberstet merged 3 commits into
crossbario:masterfrom
oberstet:fix_2250

Conversation

@oberstet

Copy link
Copy Markdown
Contributor

fixes #2250

oberstet added 3 commits July 15, 2026 11:11
…ossbario#2250)

check_websocket_compression() is an empty "# FIXME" stub, yet it is wired into
check_websocket_options(), so WebSocket `compression` config is accepted
entirely unvalidated: unknown codecs, unknown deflate attributes, wrong types
and out-of-range window-bits / memory-level all pass silently and only surface
(if at all) as a run-time error deep inside the compression backend.

Add tests to CheckWebsocketTests covering what
crossbar.router.protocol.set_websocket_options actually reads for deflate
(request_no_context_takeover, request_max_window_bits, no_context_takeover,
max_window_bits, memory_level), asserting malformed blocks are rejected and
valid ones accepted. The permissible values mirror autobahn's
PerMessageDeflateMixin: window bits 9..15 (plus 0 = "not requested" for
request_max_window_bits) and memory level 1..9.

Seven rejection tests fail ("InvalidConfigException not raised") because the
validator is empty; the validator lands in the next commit.

Note: This work was completed with AI assistance (Claude Code).
Fill the empty check_websocket_compression() stub, mirroring the structure of
check_websocket_options(): check_dict_args() for permitted keys and types, then
explicit range checks.

Only permessage-deflate is implemented in set_websocket_options(), so `deflate`
is the only accepted codec, and its accepted attributes are exactly the ones
set_websocket_options() reads. The permissible window-bits and memory-level
values are imported from autobahn's PerMessageDeflateMixin
(WINDOW_SIZE_PERMISSIBLE_VALUES / MEM_LEVEL_PERMISSIBLE_VALUES) rather than
duplicated, so the validator cannot drift from what autobahn actually accepts at
run-time. request_max_window_bits additionally accepts 0, matching autobahn's
"do not request a window size" semantics.

Makes the tests added in the previous commit pass.

Note: This work was completed with AI assistance (Claude Code).
@oberstet

Copy link
Copy Markdown
Contributor Author
image

@oberstet
oberstet merged commit 8f8f2ce into crossbario:master Jul 15, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant