Fix GCS ':' encoding for proxied multipart complete and abort#220
Merged
Conversation
GCS normalises ':' to '%3A' in the canonical resource whenever S3 subresource params (uploadId, partNumber) are present — not only for presigned URLs but also for Authorization-header proxied requests. MULTIPART_COMPLETE and MULTIPART_ABORT both include '?uploadId=X' in the canonical resource, so GCS rejects them with 403 when the key contains literal ':'. MULTIPART_UPLOAD_PART has the same issue. For GCS backends (ENDPOINT_URL contains 'googleapis'), encode ':' as '%3A' in encoded_key before signing. The proxy_pass URL uses $encoded_key so the path sent to GCS is also updated automatically. Standard S3-compatible backends (cloudserver, Scaleway) keep literal ':'. MULTIPART_INITIATE uses '?uploads' (no value) and is unaffected. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
LGTM |
The test showed that GCS rejects both literal ':' and '%3A' variants when '?uploadId=X' is included in the canonical resource. GCS computes: POST\n\napplication/xml\n\nx-amz-date:...\n/bucket/key%3A... No '?uploadId=X' — consistent with the presigned URL behaviour where '?partNumber=N&uploadId=X' is also excluded. Update MULTIPART_COMPLETE, MULTIPART_ABORT, and MULTIPART_UPLOAD_PART: for GCS, encode ':' as '%3A' AND omit uploadId/partNumber subresources from the canonical resource (the URL still carries them for GCS to route the operation; only the signature computation omits them). Standard S3-compatible backends keep literal ':' and include subresources. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
LGTM |
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
GCS normalises
:to%3Ain the canonical resource whenever S3 subresource params (uploadId,partNumber) are present — not only for presigned URLs (fixed in #218/#219) but also for Authorization-header proxied requests.MULTIPART_COMPLETEandMULTIPART_ABORTboth include?uploadId=Xin the canonical resource, so GCS rejects them with 403.MULTIPART_UPLOAD_PART(proxied part upload) has the same issue.Pattern:
MULTIPART_INITIATE(?uploads) — works, GCS does not normalise for this subresourcePRESIGN_PART(?partNumber=N&uploadId=X) — fixed in Fix ENDPOINT_URL not exposed to Lua workers in nginx #219MULTIPART_COMPLETE/MULTIPART_ABORT/MULTIPART_UPLOAD_PART(?uploadId=X) — this PRChange: for GCS backends (
ENDPOINT_URLcontainsgoogleapis), encode:as%3Ainencoded_keybefore signing. Theproxy_passURL uses$encoded_keyso the path sent to GCS is updated automatically. Standard S3-compatible backends (cloudserver, Scaleway) keep literal:.Test plan
test.yml— cloudserver round-trip test exercises complete + abort)test-uploadinscality/action-artifacts🤖 Generated with Claude Code