Conversation
Greptile SummaryThis is a patch release bumping the package version from Confidence Score: 5/5Safe to merge — single-field version bump with a well-tested security fix already in the base. The only changed file is No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Browser
participant App as App (handleCallback)
participant Core as AuthKitCore
participant WOS as WorkOS API
participant Util as sanitizeReturnPathname
Browser->>App: GET /callback?code=…&state=…
App->>App: getPKCECookieNameForState(state)
App->>App: storage.getCookie(request, cookieName)
App->>Core: verifyCallbackState({ stateFromUrl, cookieValue })
Core-->>App: { codeVerifier, returnPathname, customState, redirectUri }
App->>WOS: authenticateWithCode({ code, clientId, codeVerifier })
WOS-->>App: { accessToken, refreshToken, user, impersonator }
App->>App: encryptSession(session)
App->>App: storage.saveSession(response, encryptedSession)
App->>App: storage.clearCookie(response, cookieName, clearOptions)
App->>Util: sanitizeReturnPathname(returnPathname)
Note over Util: Parses against throwaway origin,<br/>strips host/scheme, rebuilds /path?q#h
Util-->>App: safe relative path (e.g. /dashboard)
App-->>Browser: { returnPathname, headers: Set-Cookie[], … }
Reviews (1): Last reviewed commit: "v0.5.1" | Re-trigger Greptile |
Patch release bumping
@workos/authkit-sessionfrom0.5.0to0.5.1.What's in this release
handleCallbacknow sanitizesreturnPathnamedecoded from OAuthstatebefore returning it. A craftedstatevalue (e.g.https://evil.com,//evil.com,/\evil.com) could previously flow into a downstream SDK'sLocationheader and become an open-redirect primitive. The newsanitizeReturnPathnameutility parses against a throwaway origin and rebuilds a same-origin relative path beginning with exactly one/. Thefallbackparameter goes through the same pipeline so a hostile fallback can't reopen the hole. (merged in f56e1d6)Post-merge checklist
v0.5.1and cut a GitHub releaserelease: publishedworkflow publishes to npm with provenance