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.
feat: automatically trust project's hosted handler domain (built-with domain) #1470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
feat: automatically trust project's hosted handler domain (built-with domain) #1470
Changes from all commits
d762041cfb9af8File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assertion passes because the protocol is HTTP, not because the port is wrong. Since only
https://…is added to trusted domains, any HTTP URL returnsfalseregardless of the port. The test comment says "Wrong port should NOT be trusted" but it never reaches port-matching logic. To actually verify the port-mismatch rejection, the URL should usehttps://.Prompt To Fix With AI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dev suffix breaks hosted trust
High Severity
The
getHostedHandlerDomainSuffixfunction returns the rawNEXT_PUBLIC_STACK_HOSTED_HANDLER_DOMAIN_SUFFIXenv var. In local dev, this includes an unresolved${NEXT_PUBLIC_STACK_PORT_PREFIX:-81}placeholder. This causes the backend to trust a malformed hosted domain, leading to automatic redirect URL trust failures due to a mismatch with client-used domains.Reviewed by Cursor Bugbot for commit cfb9af8. Configure here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignores hosted handler URL template
Medium Severity
Redirect, OAuth, and Turnstile trust only
https://{projectId}{domainSuffix}, but hosted handler URLs come fromNEXT_PUBLIC_STACK_HOSTED_HANDLER_URL_TEMPLATEwhen set (e.g. path-basedhttp://localhost:PORT/{projectId}/handler/...). Those real URLs can stay untrusted despite this change.Additional Locations (2)
apps/backend/src/oauth/model.tsx#L78-L81apps/backend/src/lib/turnstile.tsx#L54-L58Reviewed by Cursor Bugbot for commit cfb9af8. Configure here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hosted domain URI is pushed unconditionally on line 81, so
redirectUris.lengthis always>= 1when this guard is evaluated — thelength === 0condition can never be true and the localhost fallback is unreachable. For projects that rely onallowLocalhost: truewith no configured trusted domains, the localhost URI no longer appears inclient.redirectUris. If the oauth2-server library uses that list for auto-selection when noredirect_uriis included in the request, those OAuth flows would change behavior silently. The block should either be removed (ifvalidateRedirectUriis fully authoritative) or repositioned so the localhost fallback is still added when appropriate.Prompt To Fix With AI
Uh oh!
There was an error while loading. Please reload this page.