Uniform decompression-budget and corrupt-input handling across all permessage-* extensions
メンテナーはふだん 1 日以内に返信
関連するプルリクエストがすでにマージされています。
- #1987 @oberstet による — マージ済み
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 30/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- python
- 領域
- backend, networking
調査の方向性
Start with websocket/protocol.py and onFrameData(), then inspect the four decompress_message_data() implementations and their compression dependency versions. Add unit coverage for the listed budget and corrupt-input cases, plus protocol tests on Twisted and asyncio; run them on CPython and PyPy. Done means all backends enforce the output budget and map decode errors to PayloadCorruptError, with clean connection failures.
索引モデルが issue の本文から書いたものです。
説明
Summary
Autobahn supports four WebSocket per-message compression extensions: permessage-deflate (RFC 7692), and the non-standard permessage-bzip2, permessage-brotli and permessage-snappy. All four implement the same internal method:
def decompress_message_data(self, data, max_output_len=None): ...
The receive path (websocket/protocol.py, onFrameData()) passes in the remaining maxMessagePayloadSize budget as max_output_len. The four backends do not handle that budget, or a decode error, the same way. This issue makes their behaviour uniform.
Current behaviour
| Extension | Budget passed to the library? | Over budget | Budget already 0 | Corrupt input |
|---|---|---|---|---|
| deflate | yes (max_length) |
PayloadExceededError |
returns 1 octet, no exception (the protocol's post-inflation check then rejects it) | zlib.error |
| bzip2 | yes (max_length) |
PayloadExceededError |
PayloadExceededError |
OSError |
| brotli | no: decompresses the whole frame, then checks | PayloadExceededError, after decompression |
PayloadExceededError |
brotli.error / brotlicffi.error |
| snappy | no: decompresses the whole frame, then checks | PayloadExceededError, after decompression |
PayloadExceededError |
no exception: the input is buffered and an empty message is returned |
Decode errors are not caught in onFrameData(), so how a connection fails on a corrupt compressed frame depends on the backend and on the networking framework (Twisted or asyncio).
Target behaviour
For every extension, on CPython and PyPy, and on Twisted and asyncio:
- Budget: no backend produces more than
max_output_len + 1octets in one call. "Over budget" and "budget already 0" both raisePayloadExceededError, which is raised before the backend decompresses past the budget, not after.- brotli: use
Decompressor.process(data, output_buffer_limit=...), and raise the floor of thecompressextra tobrotli>=1.2.0(CPython) /brotlicffi>=1.2.0(PyPy), the first versions that have this argument. - snappy: python-snappy's
StreamDecompressor.decompress()has no output limit, so feed the input one framing chunk at a time (at most 64 KiB of output each) and stop at the budget. - deflate: raise
PayloadExceededErroronce the budget is used up, instead of capping the call at 1 octet.
- brotli: use
- Corrupt input: each library's decode error becomes a new
autobahn.exception.PayloadCorruptError. The protocol fails the connection the same way for every backend, on Twisted and asyncio. The snappy backend rejects malformed input instead of buffering it. - Remove or correct the code comments claiming that per-frame decompression is "bounded on the wire by
maxFramePayloadSize".
Tests
- Unit tests for every cell of the table above, on all four backends: over budget in one frame, over budget across two frames, exactly at budget, one octet over, budget already 0, and corrupt input. They must check both the exception type and that the output never exceeds the budget plus one octet.
- Protocol-level tests on Twisted and asyncio: a corrupt compressed frame, and an over-budget compressed message, each fail the connection cleanly with the expected close code.
- Run on CPython and PyPy.
Target
autobahn-python 26.10.1
- 主要言語
- Python
- スター
- 2.5k
- フォーク
- 767
- 平均マージ
- 23時間 55分
- マージ済み PR(30日)
- 25
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
crossbario/autobahn-python のほかの issue
-
CI-CD enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
crossbario/autobahn-python#1945 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug CI-CD
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
crossbario/autobahn-python#1932 ·
メンテナーはふだん 1 日以内に返信
-
CI-CD enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
crossbario/autobahn-python#1829 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug CI-CD
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
crossbario/autobahn-python#2013 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
crossbario/autobahn-python#1963 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
crossbario/autobahn-python の issue をすべて見る
似ている issue
-
infrastructure
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
khuisman/mcp-gee-sweet#1152 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
backroom bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ditto-assistant/ditto-subnet#3069 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
open-webui/open-webui#32901 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
0.3.3 bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信