Repository navigation
Storage → Strictly encode object keys for SigV4 - #129
Merged
Merged
Conversation
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.
Resolves #92
Problem
encodeURIComponent, which leaves! ' ( ) *bare on the wire, while SigV4 signatures are computed over the strictly encoded RFC 3986 formDon't forget!.mdcould fail to sync on some providers with an unexplained per file errorChanges
! ' ( ) *in object keys and in theprefixandcontinuation-tokenlist params, so the wire path matches the signed canonical form byte for byteWhy
Greptile Summary
This PR fixes a SigV4 signing mismatch by encoding the five characters (
! ' ( ) *) thatencodeURIComponentleaves bare but RFC 3986 / SigV4 requires to be percent-encoded, ensuring the bytes on the wire match the signed canonical form byte-for-byte across all providers.encodeComponent(a thin wrapper overencodeURIComponentthat also encodes the five SigV4-sensitive characters) and wires it intoencodeKeyand theprefix/continuation-tokenquery parameters ins3ListObjects.Confidence Score: 5/5
Safe to merge — the change is a narrow, well-tested encoding fix with no behavioural regressions for callers.
The
percentEncodehelper produces the correct%XXform for all five target characters. The regex[!'()*]is a literal character class with no unintended matches.encodeComponentandencodeKeycompose cleanly, and the switch ins3ListObjectsis the only remaining call site that needed updating. Unit tests cover all encoding cases, and the integration test verifies the full round-trip through a real S3-compatible endpoint.Files Needing Attention: No files require special attention.
Important Files Changed
encodeComponent(strict RFC 3986 / SigV4 encoding) and rewiresencodeKeyto use it;percentEncodehelper is correct for all five target charactersprefixandcontinuation-tokenquery parameters fromencodeURIComponenttoencodeComponent; change is minimal and consistent with the encoding fix'and/), and deleteReviews (1): Last reviewed commit: "Fix" | Re-trigger Greptile