[WIP] Block direct sign-in flow initiation from browser SPAs#3
Open
Malith-19 wants to merge 1 commit into
Open
[WIP] Block direct sign-in flow initiation from browser SPAs#3Malith-19 wants to merge 1 commit into
Malith-19 wants to merge 1 commit into
Conversation
A browser SPA initiating a sign-in flow directly via POST /flow/execute passes a public applicationId, which the server cannot use to authenticate the client. Browser SPAs must use the redirect-based authorization_code + PKCE flow, which has a true equivalent in the OAuth /authorize handler. - executeEmbeddedSignInFlowV2 now throws a ThunderIDRuntimeError when a new sign-in flow is initiated (applicationId + flowType) in a browser context. The react, vue and browser SDKs reach this via the shared core, so all are covered. Server-side (confidential client) initiation is still allowed (non-browser), and browser-side continuation with an executionId — the hosted Gate path — is unaffected. - Scoped to sign-in only: /authorize initiates authentication only, so registration and recovery have no redirect-based equivalent and are left unchanged. - Add JSDoc guidance on the react and vue embedded SignIn components and a note in the JavaScript SDK README; update tests to assert the browser block, server-side allowance, and browser continuation. Refs thunder-id/thunderid#3217
12 tasks
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.
Purpose
Block browser SPAs from initiating a sign-in flow directly via
POST /flow/execute, and require the redirect-based OAuth2authorization_code+ PKCE flow instead.A browser SPA initiating a flow passes a public
applicationId, which the server cannot use to authenticate the client. This is the SDK-side item of the secured-by-default model agreed in the design discussion. Since the SDKs have not had a release yet, this removes the capability rather than deprecating it. The config-time backend guard (a public-client SPA must use theauthorization_codegrant) is tracked separately under thunder-id/thunderid#3216.Approach
executeEmbeddedSignInFlowV2throws aThunderIDRuntimeErrorwhen a new sign-in flow is initiated (applicationId+flowType) in a browser context.@thunderid/browser,@thunderid/react, and@thunderid/vueall reach this function through the core, so a single guard covers every browser SPA SDK.window/document). Server-side / confidential-client usage (e.g.@thunderid/express, which initiates this V2 flow server-side) runs in Node, so it may still initiate the flow. The hosted Gate UI is also unaffected — it only continues a redirect-initiated flow viaexecutionId, never initiates./authorizehandler initiates authentication only, so registration and recovery have no redirect-based equivalent and are left unchanged. The V1executeEmbeddedSignInFlowtargets/oauth2/authn(a legacy, non-Thunder endpoint) and is out of scope.<SignIn>and vueSignIncomponents, plus a note in the JavaScript SDK README.Related Issues
Related PRs
thunderidrepo): [Docs] Block direct sign-in flow initiation from browser SPAs thunderid#3455Checklist
breaking changelabel added.🔧 Summary of Breaking Changes
Browser SPAs can no longer initiate a sign-in flow directly via
executeEmbeddedSignInFlowV2(the embedded<SignIn />component oruseThunderID().signIn({ applicationId })used standalone). Doing so now throws aThunderIDRuntimeError.💥 Impact
Browser SPA apps that drove sign-in with the app-native (embedded) flow. Server-side clients, and the hosted sign-in (Gate) continuation path, are not affected. The SDKs have not been released, so no published consumers are impacted.
🔄 Migration Guide
Configure the application for the
authorization_codegrant with a registeredredirect_uri, and sign in via the redirect-based flow — for example@thunderid/browser'ssignIn()or@thunderid/react's<SignInButton />. See Register an application.Security checks
Note
[WIP] — opened for testing and fine-tuning before review.