Repository navigation
fix(brand-builder): strict Content-Encoding + parallel-safe test fixtures - #3598
Merged
Merged
Conversation
Followup to PR #3396. The Accept-Encoding: identity request header disables undici auto-decompression, but a hostile server can ignore it and ship gzip/br/deflate anyway — undici still decodes, and the 1MB streaming cap measures decompressed bytes. A high-ratio bomb spikes memory before the cap fires. Now reject responses where Content-Encoding is anything other than identity (or absent) before reading the body. Server can't bypass. Also derive test fixture IDs from process.pid + Date.now() so parallel integration suites don't FK-conflict on shared organizations/users/ brands rows. Suggested by the nodejs-testing-expert review. 5 new tests cover gzip/br/deflate rejection (case-insensitive) plus an explicit identity acceptance case. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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.
Followups to #3396 from the post-merge expert reviews.
What ships
1. Strict
Content-Encodingcheck on the parse URL fetch path (server/src/routes/brand-feeds.ts)The compression-bomb defense in #3396 sends
Accept-Encoding: identityto disable undici's auto-decompression. The expert review flagged a residual gap: a hostile server can ignore that header and shipgzip/br/deflateanyway — undici still decodes, and the 1MB streaming cap measures decompressed bytes, leaving a high-ratio bomb path open.Now rejects any response where
Content-Encodingis set to anything other thanidentity(or absent) before reading the body.2. PID + timestamp suffixed test fixture IDs (
server/tests/integration/brand-properties-parse.test.ts)Hardcoded constants like
org_parse_owner_001collide with sibling integration suites under parallel execution. Suffix withprocess.pid + Date.now()so each worker gets isolated rows. Suggested by the nodejs-testing-expert pass on #3396.Tests
31 cases passing (was 26). 5 new:
Content-Encoding ∈ {gzip, br, deflate, GZIP}rejection (case-insensitive)Content-Encoding: identityacceptanceFollowups not in scope (will file separately)
safeFetch— betweenvalidateFetchUrl(DNS resolve Welcome to adcp Discussions! #1) andfetch()(DNS resolve Remove targeting_template and add pluggable product catalog system #2), a short-TTL hostile DNS record can return public→private. Cross-cutting fix requires a custom undici dispatcher; out of scope here.🤖 Generated with Claude Code