Repository navigation
feat(uploads): bind presigned PUT URLs to the file row (x-amz-meta-upload-id) and return uploadHeaders #1983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
7a879d3
feat(uploads): bind presigned PUT URLs to the file row (x-amz-meta-up…
pyramation 3e894cf
test(server-test): forward the issued uploadHeaders on presigned PUTs
pyramation 9b96c06
Merge remote-tracking branch 'origin/main' into feat/upload-id-bound-…
pyramation File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 compatibility · medium
Presigned PUT now signed over
x-amz-meta-upload-id, breaking old clientsThe server now binds the presigned PUT signature to
x-amz-meta-upload-id:presignedPutHeadersadds the header whenuploadIdis given andgeneratePresignedPutUrlmarks it as unhoistable so S3 requires it to match the signature (graphile/graphile-presigned-url-plugin/src/plugin.ts:858). Clients built against the previous release — including published versions of@constructive-io/upload-clientand any hand-rolled uploader — send onlyContent-Typeandx-amz-checksum-sha256, so their PUTs now fail withSignatureDoesNotMatch. There is no opt-out or version negotiation, so every upload from an un-upgraded client breaks until it is rebuilt against the new contract.📋 Prompt for AI Agents
In graphile/graphile-presigned-url-plugin/src/s3-signer.ts (unhoistableHeaders construction, around lines 92-111) and graphile/graphile-presigned-url-plugin/src/plugin.ts (the generatePresignedPutUrl call passing fileId, around line 858), make the
x-amz-meta-upload-idheader binding opt-in: add a flag (e.g.bindUploadIdHeader) to the plugin options/storage config that defaults to false, thread it throughpresignedPutHeadersandgeneratePresignedPutUrl, and only include the header/metadata when it is enabled — otherwise clients built against the previous signing contract fail with SignatureDoesNotMatch. Keep the confirm-worker path tolerant of uploads without the metadata when binding is disabled.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is expected, and it is what the change is for: a PUT that is not bound to its row is refused. Our clients already send the header: dashboard#322 and constructive-desktop#272 are merged, and their PUTs carry
x-amz-meta-upload-id: <fileId>. A URL that is not signed over the header accepts it, so they shipped ahead of this PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff does not show the fix described in the original finding. The full
s3-signer.tsandplugin.tsdiffs confirm thatuploadId(thefileId) is unconditionally passed togeneratePresignedPutUrland signed into the URL asx-amz-meta-upload-idwith no opt-in flag — it is always on.The user's claim that dashboard#322 and constructive-desktop#272 are already merged and shipping the header may well be true, but it does not address the compatibility risk for any other client (hand-rolled uploaders, third-party integrations, older mobile builds still in the field) that was not updated before this PR merges. The original finding is about the absence of an opt-out mechanism, not about whether specific known clients were updated.
The recommended fix — a
bindUploadIdHeaderflag defaulting tofalseso the new signing contract is opt-in — is not present anywhere in the diff. Until that flag (or equivalent version negotiation) is added, the finding stands.