Skip to content

fix(party): bound connection token decoding - #382

Merged
Alban1911 merged 1 commit into
Alban1911:mainfrom
Lng999:fix/party-token-bounds-20261020
Oct 20, 2026
Merged

Alban1911 merged 1 commit into
Alban1911:mainfrom
Lng999:fix/party-token-bounds-20261020

Conversation

@Lng999

@Lng999 Lng999 commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Pasting a compressed party token could allocate hundreds of megabytes on Rose's plugin bridge event loop. Decoding used unbounded zlib inflation and accepted payloads longer than the defined token layout. A local example expanded to about 200 MiB and was accepted as a token.

Bound token text before decoding, limit decompression output to one byte beyond the largest valid payload, and require a complete stream without trailing data. Accept only the exact v1/v2 payload sizes. Existing valid v1/v2 tokens, optional ROSE: prefixes, omitted base64 padding and acceptance of older tokens remain supported. Truncated streams were already rejected by zlib; the new checks additionally enforce complete consumption and exact payload lengths.

Validation:

  • python -m unittest party.tests.test_token_limits: 9 pass; 4 fail against base 146f7986.
  • Tests cover valid legacy/current tokens, oversized inflation, overlong text, wrong payload sizes, trailing/truncated streams and invalid input. The bounded-inflation regression uses a small fixture rather than allocating the large demonstration payload.
  • Combined audit integration verification: 367 Python tests and 5 JavaScript tests pass. Ruff and git diff --check pass.

@Alban1911
Alban1911 merged commit 6460bfe into Alban1911:main Oct 20, 2026
3 of 4 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

Development

Successfully merging this pull request may close these issues.

2 participants