Repository navigation
Restrict S3 307 redirects to trusted targets - #3514
Merged
Merged
Conversation
peterrsongg
approved these changes
Dec 2, 2026
Follow 307 redirects only to the same origin, or to HTTPS Amazon S3 hosts in the same partition when the endpoint is SDK-resolved.
Follow cross-host 307s from a configured endpoint that is itself an HTTPS S3 host, and require an S3 label on both hosts.
Compare the partition of the redirect host's region, since aws and aws-us-gov share DNS suffixes, and use customer-focused changelog wording.
Trust a configured S3 endpoint over HTTP or HTTPS while still refusing HTTPS to HTTP downgrades, and never trust S3 website endpoints.
sankettangade
force-pushed
the
stangade/s3-redirect-target-validation
branch
from
December 2, 2026 18:54
82ee61d to
b1d1be3
Compare
dscpinheiro
approved these changes
Dec 2, 2026
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.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Description
The S3 redirects plugin followed any 307 to the URL in the
Locationheader and re-signed the request for it. This change:Locationvalues are resolved first.Aws::S3::Errors::Http307Errorfor redirects it does not follow, the same error asfollow_redirects: false.Hostheader on cross-host redirects, so the request is re-signed for the new host.Compatibility
S3-compatible services behind a custom
:endpointthat send 307s to another host, scheme or port now getHttp307Error. Configure the final endpoint directly instead.Testing
spec/plugins/redirects_spec.rb(27 examples).aws-sdk-s3suite passes.f17febeb-fae8-47f7-9b3d-d129ace75740