Skip to content

Fix JWT request-resource-path to include query string#163

Open
webdz9r wants to merge 1 commit intoCyberSource:masterfrom
webdz9r:fix/jwt-request-resource-path-query-params
Open

Fix JWT request-resource-path to include query string#163
webdz9r wants to merge 1 commit intoCyberSource:masterfrom
webdz9r:fix/jwt-request-resource-path-query-params

Conversation

@webdz9r
Copy link
Copy Markdown

@webdz9r webdz9r commented Apr 22, 2026

Problem

extractResourcePath strips query parameters from the request target before signing the JWT request-resource-path claim. This causes an UNAUTHORIZED_USER 401 response on any endpoint where the actual HTTP request includes query params, because the signed path no longer matches the URL the server receives.

Example: a GET to /uw/v1/applications?status=New signs the path as /uw/v1/applications, but the server validates against /uw/v1/applications?status=New — they don't match, so auth fails.

Fix

Return request_target as-is in extractResourcePath so the signed path exactly matches the full request URL including query string. The Visa Acceptance Solutions JWT specification states that request-resource-path should be "the complete URL path for the HTTP request."

Verified

Confirmed with the Visa UAPI underwriting sandbox (apitest.cybersource.com):

  • Before fix: GET /uw/v1/applications?status=New → 401 UNAUTHORIZED_USER
  • After fix: GET /uw/v1/applications?status=New → 200 with encrypted MLE response

The extractResourcePath method was stripping query parameters from
the request target before signing the JWT. This causes UNAUTHORIZED_USER
401 errors on endpoints that require query params (e.g. GET /uw/v1/applications?status=New)
because the signed path no longer matches the actual request URL.

Return the full request_target as-is so the signed path exactly matches
the URL the server receives.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants