fix(tasks): route SafeFetch.server redirect ceiling through SECURITY_LIMITS#614
Merged
Conversation
…LIMITS The server-side SafeFetch (Node/Bun) still hardcoded MAX_REDIRECT_HOPS = 20 even after PR #609 consolidated ceilings under SECURITY_LIMITS. The browser sibling was migrated; the server path — the one that also does DNS pre- resolution and undici-Agent pinning — was not. This restores the single source of truth in packages/util/src/limits.ts.
Coverage Report
File CoverageNo changed files found. |
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.
Summary
Route the server-side
SafeFetch(Node/Bun) redirect ceiling throughSECURITY_LIMITS.safeFetchMaxRedirectHopsinstead of a local hardcoded20,matching what the browser sibling (
SafeFetch.ts) already does.Failure scenario
The consolidation into
SECURITY_LIMITSinpackages/util/src/limits.tscovered the browser
SafeFetch.tsbut missedSafeFetch.server.ts— theNode/Bun path that additionally does DNS pre-resolution and undici-Agent
connection pinning to defeat DNS rebinding. As a result the two entrypoints
could drift on their SSRF redirect-hop cap: raising or lowering the ceiling
in
limits.tswould only affect the browser path, and the server wouldsilently keep the stale value. That is exactly the drift risk the
SECURITY_LIMITSconstant was introduced to prevent.Fix
SECURITY_LIMITSfrom@workglow/util(already a peer dependencyof
@workglow/tasks).const MAX_REDIRECT_HOPS = 20;withconst MAX_REDIRECT_HOPS = SECURITY_LIMITS.safeFetchMaxRedirectHops;.Two-line change; the constant name and its call site in the redirect loop
are unchanged, and
SECURITY_LIMITS.safeFetchMaxRedirectHopsis20, sothis is behavior-preserving.
Test plan
bun run build:types— passes across all 36 packages.placement matches the browser sibling.
throw
TOO_MANY_REDIRECTS.Generated by Claude Code