Skip to content

feat: add expected_value to custom-property rules and cap gzip webhook bodies - #320

Merged
mogita merged 1 commit into
7.xfrom
feat/7x-expected-value-gzip-cap
Nov 12, 2026
Merged

mogita merged 1 commit into
7.xfrom
feat/7x-expected-value-gzip-cap

Conversation

@mogita

@mogita mogita commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Users still on v7 can't set expected_value on custom-property moderation rules, so value-operator rules are rejected. They also get no cap on gzip webhook bodies, which are decompressed before the signature check. 8.x gets both fixes by regeneration. This PR ports them to the 7.x maintenance branch for 7.2.0.

Solution

This PR ports only the generated output of GetStream/chat#20571 and GetStream/chat#20645:

  • expected_value (any JSON value, optional) on UserCustomPropertyParameters, CallCustomPropertyParameters, ContentCustomPropertyParameters and ContentCustomPropertyCountParameters.
  • gunzip_payload stops at MAX_WEBHOOK_PAYLOAD_BYTES, which is 10 MiB and can be changed at module level. It also rejects data after the gzip stream.
  • Two new negative tests and the shared _invalid/oversized_compression fixture.

To get this diff, the client was regenerated twice from the current generator, at chat d36cc5a2a0c (just before both PRs) and at 0cdfce10f9c (both merged). The only output that differs is these files. 7.x came from the older generator, so the hunks were applied by hand, and the new fields use the file's object | None style.

How to verify

  1. make lint
  2. uv sync --all-extras --dev --no-install-package getstream-rtc && make typecheck
  3. make test (485 passed locally)

BEGIN_COMMIT_OVERRIDE
feat(moderation): add expected_value to UserCustomPropertyParameters, CallCustomPropertyParameters, ContentCustomPropertyParameters and ContentCustomPropertyCountParameters, so value-operator custom-property rules can be set
fix: cap decompressed gzip webhook bodies at 10 MiB (getstream.webhook.MAX_WEBHOOK_PAYLOAD_BYTES) and reject data after the gzip stream, because decompression runs before the signature check
END_COMMIT_OVERRIDE


Note

Medium Risk
Webhook parsing runs gzip decompression before signature verification; the new cap mitigates gzip-bomb risk but changes behavior for oversized or malformed compressed payloads. The additive moderation fields are low-risk schema alignment.

Overview
Ports two maintenance fixes into 7.x: moderation models gain an optional expected_value on user/call/content custom-property parameter types, so value-based operator rules can be expressed from the SDK.

Webhook gzip handling is tightened in gunzip_payload: decompression is limited to MAX_WEBHOOK_PAYLOAD_BYTES (10 MiB), with explicit errors for oversized output, truncated streams, and trailing bytes after the gzip stream (using zlib instead of gzip.decompress). Negative webhook conformance tests and an _invalid/oversized_compression fixture cover the new failure modes.

Reviewed by Cursor Bugbot for commit 0d5f0b5. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Nov 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 433f347e-cddd-4540-8a53-a68932d0b8ec

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@mogita
mogita merged commit 138e50a into 7.x Nov 12, 2026
20 checks passed
@mogita
mogita deleted the feat/7x-expected-value-gzip-cap branch November 12, 2026 16:21
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.

1 participant