Repository navigation
Add failing tests for content URL injection - #22
Closed
cursor[bot] wants to merge 1 commit into
Closed
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
List, Get, Create, Update, and Delete must reject dot and empty path segments before sending a request, and must keep filters and field limits in the query when an identifier contains a hash or question mark.
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.
These tests fail on purpose until endpoint and content ID values can no longer change the request path or drop the query string. No production code is changed here.
List,Get,Create,Update, andDeletebuild the content URL by splicing the endpoint and content ID into a raw string. A content ID or endpoint that contains..,., or an empty segment is sent as a different path, with the API key header still set. A#or?in either value moves or replacesdraftKey,fields,filters,limit,depth, andstatusso those parameters are not the query the caller set.The tests require:
.,.., and empty segments are rejected and no HTTP request is sent.or..segment in the decoded path, or leave the selected endpoint#and?stay percent-encoded in the path, the fragment stays empty, and the caller's query is unchangedRun them with:
go test -count=1 ./...TestClient_*still passes. These fail:TestPathSegmentsThatClimbOrAreEmptyAreRejectedTestPercentEncodedDotSegmentsDoNotEscapeEndpointTestIdentifierCannotSwallowQueryA content ID that contains
/but no empty,., or..segment (for examplefoo/bar) is not covered.path.Joincurrently turns that into an extra path segment under the endpoint.