Skip to content

fix: decompress gzip-encoded HTTP responses before comparison - #24

Merged
jvmakine merged 1 commit into
mainfrom
feat/http-content-encoding
Oct 7, 2026
Merged

jvmakine merged 1 commit into
mainfrom
feat/http-content-encoding

Conversation

@jvmakine

@jvmakine jvmakine commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

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:

outcome=unable reason=cannot decode reference response as ...: decode JSON: invalid character '\x1f' looking for beginning of value

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

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>
@jvmakine
jvmakine requested a review from alecthomas as a code owner October 7, 2026 04:21
@jvmakine
jvmakine merged commit aa2781d into main Oct 7, 2026
6 checks passed
@jvmakine
jvmakine deleted the feat/http-content-encoding branch October 7, 2026 04:29
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