Skip to content

Encoding path parameters - #51

Merged
mcnulty-fp merged 7 commits into
mainfrom
inter-2503-path-encoding
Sep 24, 2026
Merged

mcnulty-fp merged 7 commits into
mainfrom
inter-2503-path-encoding

Conversation

@Orkuncakilkaya

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

Validation, generated artifacts, documentation, and focused tests are consistent and complete.

Review effort: Balanced
Findings: None

What changed in this PR

Rejects RFC 3986 dot-segments in generated path parameters to prevent unintended endpoint normalization.

Changes:

  • Validates escaped path parameters before requests.
  • Documents the restriction in generated APIs and reference docs.
  • Adds coverage for rejection and safe encoding behavior.
File Description
template/​libraries/​jersey3/​api.mustache Adds generated validation and Javadocs.
template/​libraries/​jersey3/​api_doc.mustache Documents path-parameter restrictions.
sdk/​src/​test/​java/​com/​fingerprint/​v4/​api/​PathParameterTest.java Tests path encoding and dot-segment rejection.
sdk/​src/​main/​java/​com/​fingerprint/​v4/​api/​FingerprintApi.java Applies validation in generated SDK methods.
docs/​FingerprintApi.md Updates public API documentation.
.changeset/​reject-dot-segment-path-parameters.md Records the patch-level behavior change.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

An ID given to `getEvent`, `updateEvent` or `deleteVisitorData` is
percent-encoded, so slashes cannot inject extra path segments. A value
that is not a valid identifier is now rejected before a request is sent.

The check lives in the api.mustache template and is applied to every
path parameter on regeneration. The thrown message stays generic, since
it can surface to end users.

INTER-2503
@Orkuncakilkaya
Orkuncakilkaya force-pushed the inter-2503-path-encoding branch from 3792cc8 to 964e73b Compare September 22, 2026 22:38
@Orkuncakilkaya
Orkuncakilkaya marked this pull request as ready for review September 22, 2026 22:43
@Orkuncakilkaya Orkuncakilkaya changed the title fix: reject dot-segments as path parameters Encoding path parameters Sep 22, 2026
mcnulty-fp
mcnulty-fp previously approved these changes Sep 23, 2026

@mcnulty-fp mcnulty-fp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a few nit picks.

Comment thread template/libraries/jersey3/api.mustache Outdated
Comment thread template/libraries/jersey3/api.mustache Outdated
Co-authored-by: Dan McNulty <212590662+mcnulty-fp@users.noreply.github.com>
Orkuncakilkaya and others added 2 commits September 24, 2026 12:26
Co-authored-by: Dan McNulty <212590662+mcnulty-fp@users.noreply.github.com>
Applies the exception message and comment changes from b40b75d and
f353acf to the generated code, and updates PathParameterTest for the new
message, which now names the offending value and no longer sets an HTTP
status code.
The path parameter guard threw ApiException(String), which leaves the
status code at its default 0, while the missing-required-parameter guard
in the same method throws ApiException(400, ...). Both are client-side
parameter validation, so both now report 400.

Also drops the isPathParam note from the optional parameter table in
api_doc.mustache: a path parameter is always required, so that branch
could never render. Generated docs are unchanged.

@mcnulty-fp mcnulty-fp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more small change then this should be good to go. Thanks!

Comment thread template/libraries/jersey3/api.mustache Outdated
Orkuncakilkaya and others added 2 commits September 24, 2026 17:33
Co-authored-by: Dan McNulty <212590662+mcnulty-fp@users.noreply.github.com>
Applies the exception constructor change from b73f22f to the generated
code and drops the matching status code assertion from
PathParameterTest.
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Following releases will be created using changesets from this PR:

java-sdk@8.7.1

Patch Changes

  • sdk: getEvent, updateEvent, and deleteVisitorData now validate their ID path parameter and throw an ApiException without sending a request when the value is not a valid identifier. (964e73b)

@mcnulty-fp
mcnulty-fp merged commit b09c774 into main Sep 24, 2026
19 checks passed
@mcnulty-fp
mcnulty-fp deleted the inter-2503-path-encoding branch September 24, 2026 16:10
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.

3 participants