Commit 8f8f2ce
authored
Fix 2250 (#2255)
* start new dev branch; add audit file
* Add failing tests: WebSocket compression config must be validated (#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).
* Implement the WebSocket compression config validator (#2250)
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).1 parent c4d9d42 commit 8f8f2ce
3 files changed
Lines changed: 126 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
1594 | 1595 | | |
1595 | 1596 | | |
1596 | 1597 | | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
1597 | 1604 | | |
1598 | 1605 | | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
1599 | 1609 | | |
1600 | | - | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
1601 | 1648 | | |
1602 | 1649 | | |
1603 | 1650 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
219 | 289 | | |
220 | 290 | | |
221 | 291 | | |
| |||
0 commit comments