You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 85a3226
Browse filesBrowse the repository at this point in the historyBrowse files
fix(security): stop redirects replaying request bodies and leaking credentials (#6941)
* fix(security): stop redirects replaying request bodies and leaking credentials
`secureFetchWithPinnedIP` passed its options straight into the redirect
recursion, so a 301/302/303 replayed the original method and body — delivering a
non-idempotent write twice — and forwarded `Authorization` and every other caller
header to whatever origin the upstream named.
`followRedirectsGuarded`, a hundred lines above it in the same file, already had
the correct RFC 9110 rules. The two had drifted, and the drift is the bug. Both
now route through one `resolveRedirectHop`:
- 303, and 301/302 on POST, degrade to a bodyless GET and drop the entity headers
that described the removed body.
- A cross-origin hop drops every caller header, not just `Authorization`.
- A cross-origin hop that would forward a body is refused.
`stripAuthOnRedirect` still narrows same-origin hops for endpoints that redirect
to a target carrying its own signed URL.
Verified by stashing the fix and re-running: 4 of the 6 new tests fail against
the old code. The 2 that pass either way cover same-origin behaviour that was
already correct.
* fix(api): preserve HTTP redirect compatibility
Copy file name to clipboardExpand all lines: apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/switch/switch.tsx
Copy file name to clipboardExpand all lines: apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/sub-block.tsx
Copy file name to clipboardExpand all lines: apps/sim/blocks/blocks/api.ts
+24Lines changed: 24 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -133,6 +133,22 @@ Example:
133
133
description: 'Allow retries for POST/PATCH requests (may create duplicate requests)',
134
134
mode: 'advanced',
135
135
},
136
+
{
137
+
id: 'redirectPolicyVersion',
138
+
title: 'Redirect policy version',
139
+
type: 'short-input',
140
+
defaultValue: 'standard-v1',
141
+
hidden: true,
142
+
},
143
+
{
144
+
id: 'sendCredentialsOnCrossOriginRedirect',
145
+
title: 'Send credentials on cross-origin redirects',
146
+
type: 'switch',
147
+
defaultValue: true,
148
+
description:
149
+
'Forward credential-bearing headers when a redirect changes scheme, host, or port. Enabled by default for compatibility; disable it when redirected destinations should not receive the same credentials.',
150
+
mode: 'advanced',
151
+
},
136
152
{
137
153
id: 'proxyUrl',
138
154
title: 'Proxy URL',
@@ -163,6 +179,14 @@ Example:
163
179
type: 'boolean',
164
180
description: 'Allow retries for non-idempotent methods like POST/PATCH',
0 commit comments