Skip to content

Add failing tests for content URL injection - #22

Closed
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/url-injection-tests-ac58
Closed

cursor[bot] wants to merge 1 commit into
mainfrom
cursor/url-injection-tests-ac58

Conversation

@cursor

@cursor cursor Bot commented Nov 20, 2026

Copy link
Copy Markdown

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, and Delete build 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 replaces draftKey, fields, filters, limit, depth, and status so those parameters are not the query the caller set.

The tests require:

  • ., .., and empty segments are rejected and no HTTP request is sent
  • a percent-encoded dot segment cannot remain a . 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 unchanged

Run them with:

go test -count=1 ./...

TestClient_* still passes. These fail:

  • TestPathSegmentsThatClimbOrAreEmptyAreRejected
  • TestPercentEncodedDotSegmentsDoNotEscapeEndpoint
  • TestIdentifierCannotSwallowQuery

A content ID that contains / but no empty, ., or .. segment (for example foo/bar) is not covered. path.Join currently turns that into an extra path segment under the endpoint.

Open in Web Open in Cursor 

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants