Skip to content

fix: URI-encode path parameters in API client request URLs (#1157) - #1252

Merged
hman38705 merged 5 commits into
mainfrom
fix/path-parameters-are-interpolated-into-request-ur
Jul 28, 2026
Merged

fix: URI-encode path parameters in API client request URLs (#1157)#1252
hman38705 merged 5 commits into
mainfrom
fix/path-parameters-are-interpolated-into-request-ur

Conversation

@hman38705

Copy link
Copy Markdown
Contributor

Conflict-resolved re-submission of #1240 (fork PR, no push access to update it directly). Closes #1240 in favor of this.

euniceamoni and others added 5 commits July 27, 2026 09:20
PII (email address) was being sent as a URL query parameter on
GET /api/v1/newsletter/gdpr/export, exposing it to server access
logs, browser history, and proxy logs.

Changes:
- frontend: newsletterGdprExport now uses POST with body: { email }
  instead of GET with params: { email } (client.ts)
- backend: added NewsletterExportBody struct, changed handler extractor
  from Query to Json, updated utoipa path attribute to post,
  updated route registration from get() to post() (handlers.rs, main.rs)
- tests: updated it.each entry to expect POST; added new test in
  'GDPR export (#1156)' describe block asserting email is in the
  request body and absent from the URL

Fixes #1156
Update openapi.yaml /api/v1/newsletter/gdpr/export from GET with
query parameter to POST with requestBody (EmailRequest schema), matching
the handler change in handlers.rs.

Update SPEC_ROUTES in openapi_contract_test.rs from GET to POST to
keep the contract test in sync with the spec and runtime router.
Wrap all path-segment interpolations with encodeURIComponent() to
prevent path corruption and request-smuggling when values contain
special characters (/, ?, #).

Affected endpoints: getBlockchainMarket, getUserBets, getOracleResult,
getTransactionStatus, resolveMarket, emailPreview.

Add URI encoding test block (7 tests) covering all 6 endpoints and
asserting that slash-containing values produce correctly encoded paths.
@hman38705
hman38705 merged commit dd027a9 into main Jul 28, 2026
4 of 50 checks passed
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