Encode dynamic API path values as segments - #431
Open
0xmrma wants to merge 1 commit into
Open
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.
Summary
Encode all caller-provided values that are inserted into App Store Server API URL paths. This preserves each value as one path segment and prevents URL parsing from treating slashes, query delimiters, fragments, or dot segments as request-target syntax.
What changed
encodePathSegmenthelper toAppStoreServerAPIClient..and..values because WHATWG URL parsing normalizes even their percent-encoded forms. These values are encoded again so they cannot remove or traverse URL path segments.Behavioral effect
For normal identifiers such as
com.example.productanden-US, the generated paths are unchanged. Values containing URL syntax characters are serialized as data inside one path segment, allowing the server to reject malformed identifiers without the client changing the structure of the request path.This also keeps the public method boundary aligned with the request target: a value containing URL syntax characters remains data inside the parameter’s path segment instead of changing the structure of the request path.
Validation
npm run buildnpm test -- --runInBandResult: 20 test suites passed, 332 tests passed.