Repository navigation
feat: add expected_value to custom-property rules and cap gzip webhook bodies - #320
Merged
Merged
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Users still on v7 can't set
expected_valueon 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 the7.xmaintenance 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) onUserCustomPropertyParameters,CallCustomPropertyParameters,ContentCustomPropertyParametersandContentCustomPropertyCountParameters.gunzip_payloadstops atMAX_WEBHOOK_PAYLOAD_BYTES, which is 10 MiB and can be changed at module level. It also rejects data after the gzip stream._invalid/oversized_compressionfixture.To get this diff, the client was regenerated twice from the current generator, at chat
d36cc5a2a0c(just before both PRs) and at0cdfce10f9c(both merged). The only output that differs is these files.7.xcame from the older generator, so the hunks were applied by hand, and the new fields use the file'sobject | Nonestyle.How to verify
make lintuv sync --all-extras --dev --no-install-package getstream-rtc && make typecheckmake test(485 passed locally)BEGIN_COMMIT_OVERRIDE
feat(moderation): add
expected_valuetoUserCustomPropertyParameters,CallCustomPropertyParameters,ContentCustomPropertyParametersandContentCustomPropertyCountParameters, so value-operator custom-property rules can be setfix: 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 checkEND_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_valueon 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 toMAX_WEBHOOK_PAYLOAD_BYTES(10 MiB), with explicit errors for oversized output, truncated streams, and trailing bytes after the gzip stream (usingzlibinstead ofgzip.decompress). Negative webhook conformance tests and an_invalid/oversized_compressionfixture 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.