Repository navigation
fix: decompress gzip-encoded HTTP responses before comparison - #24
Merged
Merged
Conversation
Ingress decodes an HTTP JSON response against its declared schema, but it passed the raw body to the JSON decoder without honouring Content-Encoding. A backend that gzips its response, such as a Rails frontend behind Rack::Deflater, then failed to decode and quarantined the candidate even though both sides returned the same data. Decode the body per its Content-Encoding first so compressed and identity responses compare equal. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Ingress compares an HTTP JSON response by decoding its body against the declared schema, but the decode path only checked Content-Type and passed the raw bytes straight to the JSON decoder. When a backend compresses its response, the decoder sees gzip bytes rather than JSON and fails, which quarantines the candidate even though both sides returned identical data. We hit this against a Rails frontend behind Rack::Deflater, where every compared endpoint reported:
The fix decodes the HTTP JSON body according to its Content-Encoding before unmarshalling: identity passes through, gzip is inflated under the existing body-size limit, and any other encoding is rejected with a clear error instead of a confusing decode failure. Because both the reference and candidate bodies go through the same step, a gzipped response and an identity one now compare equal. The gRPC path already handles its own framed compression, so this only touches the raw HTTP JSON path.
🤖 Generated with Claude Code