feat: Add optional issuer option for session token validation - #1694
feat: Add optional issuer option for session token validation#1694m0tzy wants to merge 2 commits into
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
Original prompt from madison.packer
|
Greptile SummaryThis PR adds optional issuer validation for session access tokens.
Confidence Score: 4/5The PR is not yet safe to merge because an explicitly configured empty-string issuer still disables issuer validation in both authentication paths. The previous issuer-validation finding remains unresolved: both Files Needing Attention: src/user-management/session.ts, src/user-management/user-management.ts Important Files Changed
|
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Description
Adds an opt-in
issclaim check when verifying session access tokens (authenticateWithSessionCookieandloadSealedSession(...).authenticate()). A newWorkOSOptions.issuer?: string | string[]is threaded throughUserManagement.issuerto bothisValidJwtimplementations and passed straight tojose.jwtVerify, which natively accepts a single issuer or a list:When
issueris not set, behavior is unchanged (noissvalidation). Opt-in rather than defaulted because the API does not mint a single issuer shape — it varies by environment (https://api.workos.comfor legacy environments,https://api.workos.com/user_management/<clientId>for environments created since mid-2025, custom auth domains, and flag-gated path variants). No env var is added here; the core SDK only readsWORKOS_API_KEY/WORKOS_CLIENT_IDfrom the environment and this option is passed programmatically like the rest ofWorkOSOptions.All edits are within
@oagen-ignoreblocks / ignore-marked files. Companion PRs: workos/authkit-nextjs#476, workos/authkit-remix#90, workos/authkit-react-router#85.Documentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
README updated in this PR; no docs-site change required.
Link to Devin session: https://app.devin.ai/sessions/0ee38e859a9849658a7cdb2d215d89a6
Open in Devin Desktop: https://app.devin.ai/desktop/session/0ee38e859a9849658a7cdb2d215d89a6?variant=devin
Requested by: @m0tzy