Skip to content

fix(files): keep the signed Host header when s3_endpoint_url rewrites the upload URL - #294

Merged
jfrench9 merged 1 commit into
mainfrom
bugfix/presigned-upload-host
Nov 8, 2026
Merged

jfrench9 merged 1 commit into
mainfrom
bugfix/presigned-upload-host

Conversation

@jfrench9

@jfrench9 jfrench9 commented Nov 8, 2026

Copy link
Copy Markdown
Member

Summary

FileClient.upload with s3_endpoint_url set rewrote the presigned upload URL's scheme and host and sent the PUT with the new host. SigV4 signs the Host header, so the S3 server answered 403 SignatureDoesNotMatch. LocalStack had skipped signature validation, which is why the override ever appeared to work; the dev stack's S3 server since RoboFinSystems/robosystems#2000 checks it, as AWS S3 does. The connection now goes to the override while the request carries the Host the URL was signed for. Nothing changes when the option is unset.

Reproduced against the dev stack with a SigV4 presigned PUT: host swapped → 403; host swapped with the signed Host header → 200.

Scope

Patch. The option keeps its name and meaning, so the stable tier is unchanged. No server release is needed; the fix works against any SigV4 endpoint. The option's comments and the clients README no longer describe it as a LocalStack switch.

Tests

  • The override test now asserts the connection URL and the Host header separately.
  • New: without an override the presigned URL is used as signed and no Host header is set.
  • 26 file-client tests, ruff, format and basedpyright green.

Found during the supplyflow dev-stack migration, whose container-side catalog upload waits on this release.

🤖 Generated with Claude Code

… the upload URL

With s3_endpoint_url set, FileClient.upload rewrote the presigned URL's host
and sent the request with the new one. SigV4 binds the Host header, so the
S3 server answered 403 SignatureDoesNotMatch; LocalStack's skipped signature
checks had hidden it. The connection now goes to the override while the
request carries the Host the URL was signed for.
@jfrench9
jfrench9 merged commit f186a9d into main Nov 8, 2026
6 checks passed
@jfrench9
jfrench9 deleted the bugfix/presigned-upload-host branch November 8, 2026 01:30
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