@W-22699952@ HttpOnly id_token#3853
Closed
vcua-mobify wants to merge 1 commit into
Closed
Conversation
|
Git2Gus App is installed but the |
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Contributor
Author
|
Closing as requirements have changed and |
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.
This PR flips
id_tokento HttpOnly and strips theid_tokenfield from the SLAS response body so the JWT is only readable via the cookie. Theid_tokencookie is intentionally not added to the upstream-proxy strip list — it carries no SCAPI authorization material and follows the same pattern as the other identity-bearing cookies (e.g.customer_id).The commerce-sdk-react auth module already routes
id_tokenreads/writes through the cookie store whenenableHttpOnlySessionCookiesis on (HTTPONLY_COOKIE_BACKED_KEYS, added in #3830), so no runtime change is needed there. With the cookie now HttpOnly, JS reads ofid_tokenreturn'', matching the existing behavior foridp_access_token/idp_refresh_token. The doc comment on that set was updated to reflect this.Types of Changes
Changes
pwa-kit-runtime:idTokencookie config now setshttpOnly: trueand declaresslasKey: 'id_token', so the SLAS proxy emits the cookie HttpOnly and strips theid_tokenfield from the response body.pwa-kit-runtime: updated comments inprocess-token-response.jsto reflect the new HttpOnly treatment.commerce-sdk-react: updated theHTTPONLY_COOKIE_BACKED_KEYSdoc comment to listid_tokenalongsideidp_access_tokenandidp_refresh_tokenas HttpOnly/unreadable-from-JS keys included for routing symmetry.idTokeninto the HttpOnly assertion group inhttponly-cookie-config.test.js; flipped the cookie attribute assertion and added a body-strip assertion inprocess-token-response.test.js.v3.19.0-dev.How to Test-Drive This PR
enableHttpOnlySessionCookiesturned on against a SLAS proxy./shopper/auth/v1/organizations/.../oauth2/token:Set-Cookieforid_token_{siteId}carriesHttpOnly; Secure; Path=/.id_tokenfield.document.cookiedoes not includeid_token_{siteId}, while the cookie is still present in DevTools → Application → Cookies./oauth2/revokeor equivalent), confirmid_token_{siteId}is expired (Max-Age=0 / Expires in the past).cd packages/pwa-kit-runtime && npm test -- --testPathPattern='httponly-cookie-config|process-token-response'Checklists
General
Accessibility Compliance
Localization