Skip to content

fix(auth-ui): guard AuthView route lookup against prototype segments - #323

Closed
prisis wants to merge 8 commits into
alphafrom
fix/auth-ui-route-lookup-guard
Closed

prisis wants to merge 8 commits into
alphafrom
fix/auth-ui-route-lookup-guard

Conversation

@prisis

@prisis prisis commented Aug 2, 2026

Copy link
Copy Markdown
Member

Work from an agent worktree, pushed under a descriptive name (local branch was worktree-agent-adfed38045ccd5c2b).
Branched before #288/#289 landed, so it needs a rebase onto current alpha before merge.

Commits

  • fix(auth-ui): guard AuthView route lookup against prototype segments
  • fix(auth-ui): sniff empty-MIME org-logo uploads like the avatar path
  • test(auth-ui): fix flaky assertion count in avatar upload test
  • fix(auth-ui): gate sign-up card, route, and footer link on the discovered signUp flag
  • fix(auth-ui): merge the invitation bounce params into redirects.signIn's existing query
  • docs(auth-ui): record the discovery-rebuild vs in-flight form state trade-off
  • fix(auth-ui): re-sync the auth-ui registry payloads from source
  • ci: run the auth-ui registry drift check unconditionally

prisis and others added 8 commits August 1, 2026 16:38
The React AuthView dispatched the URL segment through a plain object
literal, which inherits Object.prototype. A segment naming an inherited
member (valueOf, constructor, toString) resolved to that member instead
of falling back to the sign-in card, crashing the page or rendering
garbage. Guard the lookup with Object.hasOwn.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
createOrganizationLogoController still carried the exact predicate that
avatar.ts was explicitly fixed for: a File with an empty type skipped
the accept-list check entirely, letting arbitrary bytes through under
any file name. Extract the shared isAcceptedImage helper out of
avatar.ts and route both controllers through it, so the empty-type
handling can't drift between the two copies again.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sharing isAcceptedImage between the avatar and org-logo controllers
made the accept-list check async on every path, not just the
empty-type sniff, shifting the upload call by one microtask. The
existing test split its two assertions across a waitFor callback and a
trailing expect() under expect.assertions(2), which over-counts on a
waitFor retry; move both assertions inside the callback.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ered signUp flag

The server can close self-serve sign-up via
emailAndPassword.disableSignUp, and resolveContext already resolved it
onto ControllerContext.signUp — but no port ever read it. SignUpCard
still rendered a full form that fails on submit, AuthView still routed
/auth/sign-up to it, and SignInCard's footer still advertised the
link. Wire signUp through all three surfaces in all five ports,
mirroring how the credentials flag is already consumed, and add a
static parity test so the gap can't reopen silently in one port.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…n's existing query

The invitation sign-in bounce appended ?redirectTo=... blindly, so an
app whose redirects.signIn already carried a query (e.g.
/auth?tab=sign-in, common when hosting every screen on one AuthView
route) got a mangled second ? and the invitation was lost. Extract the
parse-and-merge already proven in withRedirectTo into a mergeQuery
helper, and route the bounce through it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…rade-off

provider.tsx's core memo rebuilds every controller memoized on it when
a discovery answer lands, which loses whatever the user already typed
if this happens after they started. Measured rather than fixed: the
realistic window is narrow for manual typing (a same-origin GET fired
on mount usually resolves well before a human types), though a
password manager's autofill can still race it. Both fix directions
(a stable accessor through ControllerContext's public shape, or a
generic seed/hydrate seam on Controller) are bigger than this plan's
scope, so the trade-off is documented next to discoveryKey and pinned
by a characterization test instead.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
registry/auth-ui-{react,vue,svelte,solid,angular} mirror
packages/auth-ui/src and had drifted 113 files behind it, including the
empty-MIME avatar sniff, the open-redirect guard on social/magic-link/
one-tap callbackURLs, the stale-refetch generation counter, and every
fix from this session (the AuthView prototype guard, the org-logo
sniff, the signUp gate, and the invitation-bounce mergeQuery). Every
registry file scaffolded by `lunora registry add auth-ui-*` while this
drift was live carries the vulnerable/stale copies until re-synced by
hand; this closes that gap for new installs going forward. Generated
via `pnpm --filter @lunora/auth-ui sync:registry` — no hand edits.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The auth-ui registry drift check ran as the last step of the `prettier`
job, gated on the frontend_lintable path filter and masked whenever an
earlier step in that job failed — drift landed on alpha despite the
check nominally existing in CI. Move it into its own always-run job
(no path filter, modeled on the `secrets` job) and add it to
lint-required-check's needs so a failure still blocks the single
required status check.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@prisis, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 55 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 115ddaab-a712-41d4-8de1-4bec64486e12

📥 Commits

Reviewing files that changed from the base of the PR and between 6a4dd72 and 30dd1ba.

⛔ Files ignored due to path filters (122)
  • packages/auth-ui/__tests__/core/discovery.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/auth-ui/__tests__/core/invitations.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/auth-ui/__tests__/core/organization-logo.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/auth-ui/__tests__/core/redirect-to.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/auth-ui/__tests__/core/sign-up-gate-parity.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**
  • packages/auth-ui/__tests__/react/auth-view.test.tsx is excluded by !**/__tests__/** and included by packages/**
  • packages/auth-ui/__tests__/react/discovery-rebuild.test.tsx is excluded by !**/__tests__/** and included by packages/**
  • packages/auth-ui/__tests__/react/sign-up-gate.test.tsx is excluded by !**/__tests__/** and included by packages/**
  • packages/auth-ui/__tests__/react/user-account-cards.test.tsx is excluded by !**/__tests__/** and included by packages/**
  • registry/auth-ui-angular/angular/auth-cards.ts is excluded by none and included by none
  • registry/auth-ui-angular/angular/auth-view.ts is excluded by none and included by none
  • registry/auth-ui-angular/angular/index.ts is excluded by none and included by none
  • registry/auth-ui-angular/angular/organization.ts is excluded by none and included by none
  • registry/auth-ui-angular/angular/primitives.ts is excluded by none and included by none
  • registry/auth-ui-angular/angular/settings-cards.ts is excluded by none and included by none
  • registry/auth-ui-angular/angular/two-factor-setup-card.ts is excluded by none and included by none
  • registry/auth-ui-angular/core/admin-users.ts is excluded by none and included by none
  • registry/auth-ui-angular/core/avatar.ts is excluded by none and included by none
  • registry/auth-ui-angular/core/create-resource-controller.ts is excluded by none and included by none
  • registry/auth-ui-angular/core/invitations.ts is excluded by none and included by none
  • registry/auth-ui-angular/core/localization.ts is excluded by none and included by none
  • registry/auth-ui-angular/core/magic-link.ts is excluded by none and included by none
  • registry/auth-ui-angular/core/one-tap.ts is excluded by none and included by none
  • registry/auth-ui-angular/core/organization-logo.ts is excluded by none and included by none
  • registry/auth-ui-angular/core/redirect-to.ts is excluded by none and included by none
  • registry/auth-ui-angular/core/social.ts is excluded by none and included by none
  • registry/auth-ui-react/core/admin-users.ts is excluded by none and included by none
  • registry/auth-ui-react/core/avatar.ts is excluded by none and included by none
  • registry/auth-ui-react/core/create-resource-controller.ts is excluded by none and included by none
  • registry/auth-ui-react/core/invitations.ts is excluded by none and included by none
  • registry/auth-ui-react/core/localization.ts is excluded by none and included by none
  • registry/auth-ui-react/core/magic-link.ts is excluded by none and included by none
  • registry/auth-ui-react/core/one-tap.ts is excluded by none and included by none
  • registry/auth-ui-react/core/organization-logo.ts is excluded by none and included by none
  • registry/auth-ui-react/core/redirect-to.ts is excluded by none and included by none
  • registry/auth-ui-react/core/social.ts is excluded by none and included by none
  • registry/auth-ui-react/react/auth-cards.tsx is excluded by none and included by none
  • registry/auth-ui-react/react/auth-view.tsx is excluded by none and included by none
  • registry/auth-ui-react/react/extras.tsx is excluded by none and included by none
  • registry/auth-ui-react/react/index.ts is excluded by none and included by none
  • registry/auth-ui-react/react/organization.tsx is excluded by none and included by none
  • registry/auth-ui-react/react/primitives.tsx is excluded by none and included by none
  • registry/auth-ui-react/react/provider.tsx is excluded by none and included by none
  • registry/auth-ui-react/react/settings-cards.tsx is excluded by none and included by none
  • registry/auth-ui-react/react/two-factor-setup-card.tsx is excluded by none and included by none
  • registry/auth-ui-solid/core/admin-users.ts is excluded by none and included by none
  • registry/auth-ui-solid/core/avatar.ts is excluded by none and included by none
  • registry/auth-ui-solid/core/create-resource-controller.ts is excluded by none and included by none
  • registry/auth-ui-solid/core/invitations.ts is excluded by none and included by none
  • registry/auth-ui-solid/core/localization.ts is excluded by none and included by none
  • registry/auth-ui-solid/core/magic-link.ts is excluded by none and included by none
  • registry/auth-ui-solid/core/one-tap.ts is excluded by none and included by none
  • registry/auth-ui-solid/core/organization-logo.ts is excluded by none and included by none
  • registry/auth-ui-solid/core/redirect-to.ts is excluded by none and included by none
  • registry/auth-ui-solid/core/social.ts is excluded by none and included by none
  • registry/auth-ui-solid/solid/auth-cards.tsx is excluded by none and included by none
  • registry/auth-ui-solid/solid/auth-view.tsx is excluded by none and included by none
  • registry/auth-ui-solid/solid/index.ts is excluded by none and included by none
  • registry/auth-ui-solid/solid/organization.tsx is excluded by none and included by none
  • registry/auth-ui-solid/solid/primitives.tsx is excluded by none and included by none
  • registry/auth-ui-solid/solid/settings-cards.tsx is excluded by none and included by none
  • registry/auth-ui-solid/solid/two-factor-setup-card.tsx is excluded by none and included by none
  • registry/auth-ui-svelte/core/admin-users.ts is excluded by none and included by none
  • registry/auth-ui-svelte/core/avatar.ts is excluded by none and included by none
  • registry/auth-ui-svelte/core/create-resource-controller.ts is excluded by none and included by none
  • registry/auth-ui-svelte/core/invitations.ts is excluded by none and included by none
  • registry/auth-ui-svelte/core/localization.ts is excluded by none and included by none
  • registry/auth-ui-svelte/core/magic-link.ts is excluded by none and included by none
  • registry/auth-ui-svelte/core/one-tap.ts is excluded by none and included by none
  • registry/auth-ui-svelte/core/organization-logo.ts is excluded by none and included by none
  • registry/auth-ui-svelte/core/redirect-to.ts is excluded by none and included by none
  • registry/auth-ui-svelte/core/social.ts is excluded by none and included by none
  • registry/auth-ui-svelte/registry.json is excluded by none and included by none
  • registry/auth-ui-svelte/svelte/AuthCard.svelte is excluded by none and included by none
  • registry/auth-ui-svelte/svelte/AuthView.svelte is excluded by none and included by none
  • registry/auth-ui-svelte/svelte/ChangeEmailCard.svelte is excluded by none and included by none
  • registry/auth-ui-svelte/svelte/ChangePasswordCard.svelte is excluded by none and included by none
  • registry/auth-ui-svelte/svelte/DeleteAccountCard.svelte is excluded by none and included by none
  • registry/auth-ui-svelte/svelte/ErrorToaster.svelte is excluded by none and included by none
  • registry/auth-ui-svelte/svelte/MembersCard.svelte is excluded by none and included by none
  • registry/auth-ui-svelte/svelte/OrganizationSettingsCard.svelte is excluded by none and included by none
  • registry/auth-ui-svelte/svelte/OrganizationsCard.svelte is excluded by none and included by none
  • registry/auth-ui-svelte/svelte/PasskeysCard.svelte is excluded by none and included by none
  • registry/auth-ui-svelte/svelte/ProfileCard.svelte is excluded by none and included by none
  • registry/auth-ui-svelte/svelte/ResetPasswordCard.svelte is excluded by none and included by none
  • registry/auth-ui-svelte/svelte/ResetPasswordOtpCard.svelte is excluded by none and included by none
  • registry/auth-ui-svelte/svelte/SessionsCard.svelte is excluded by none and included by none
  • registry/auth-ui-svelte/svelte/SignInCard.svelte is excluded by none and included by none
  • registry/auth-ui-svelte/svelte/SignUpCard.svelte is excluded by none and included by none
  • registry/auth-ui-svelte/svelte/TwoFactorCard.svelte is excluded by none and included by none
  • registry/auth-ui-svelte/svelte/TwoFactorSetupCard.svelte is excluded by none and included by none
  • registry/auth-ui-svelte/svelte/index.ts is excluded by none and included by none
  • registry/auth-ui-vue/core/admin-users.ts is excluded by none and included by none
  • registry/auth-ui-vue/core/avatar.ts is excluded by none and included by none
  • registry/auth-ui-vue/core/create-resource-controller.ts is excluded by none and included by none
  • registry/auth-ui-vue/core/invitations.ts is excluded by none and included by none
  • registry/auth-ui-vue/core/localization.ts is excluded by none and included by none
  • registry/auth-ui-vue/core/magic-link.ts is excluded by none and included by none
  • registry/auth-ui-vue/core/one-tap.ts is excluded by none and included by none
  • registry/auth-ui-vue/core/organization-logo.ts is excluded by none and included by none
  • registry/auth-ui-vue/core/redirect-to.ts is excluded by none and included by none
  • registry/auth-ui-vue/core/social.ts is excluded by none and included by none
  • registry/auth-ui-vue/registry.json is excluded by none and included by none
  • registry/auth-ui-vue/vue/AuthCard.vue is excluded by none and included by none
  • registry/auth-ui-vue/vue/AuthView.vue is excluded by none and included by none
  • registry/auth-ui-vue/vue/ChangeEmailCard.vue is excluded by none and included by none
  • registry/auth-ui-vue/vue/ChangePasswordCard.vue is excluded by none and included by none
  • registry/auth-ui-vue/vue/DeleteAccountCard.vue is excluded by none and included by none
  • registry/auth-ui-vue/vue/ErrorToaster.vue is excluded by none and included by none
  • registry/auth-ui-vue/vue/MembersCard.vue is excluded by none and included by none
  • registry/auth-ui-vue/vue/OrganizationSettingsCard.vue is excluded by none and included by none
  • registry/auth-ui-vue/vue/OrganizationsCard.vue is excluded by none and included by none
  • registry/auth-ui-vue/vue/PasskeysCard.vue is excluded by none and included by none
  • registry/auth-ui-vue/vue/ProfileCard.vue is excluded by none and included by none
  • registry/auth-ui-vue/vue/ResetPasswordCard.vue is excluded by none and included by none
  • registry/auth-ui-vue/vue/ResetPasswordOtpCard.vue is excluded by none and included by none
  • registry/auth-ui-vue/vue/SessionsCard.vue is excluded by none and included by none
  • registry/auth-ui-vue/vue/SignInCard.vue is excluded by none and included by none
  • registry/auth-ui-vue/vue/SignUpCard.vue is excluded by none and included by none
  • registry/auth-ui-vue/vue/TwoFactorCard.vue is excluded by none and included by none
  • registry/auth-ui-vue/vue/TwoFactorSetupCard.vue is excluded by none and included by none
  • registry/auth-ui-vue/vue/index.ts is excluded by none and included by none
📒 Files selected for processing (18)
  • .github/workflows/lint.yml
  • packages/auth-ui/src/angular/auth-cards.ts
  • packages/auth-ui/src/angular/auth-view.ts
  • packages/auth-ui/src/core/avatar.ts
  • packages/auth-ui/src/core/invitations.ts
  • packages/auth-ui/src/core/organization-logo.ts
  • packages/auth-ui/src/core/redirect-to.ts
  • packages/auth-ui/src/react/auth-cards.tsx
  • packages/auth-ui/src/react/auth-view.tsx
  • packages/auth-ui/src/react/provider.tsx
  • packages/auth-ui/src/solid/auth-cards.tsx
  • packages/auth-ui/src/solid/auth-view.tsx
  • packages/auth-ui/src/svelte/AuthView.svelte
  • packages/auth-ui/src/svelte/SignInCard.svelte
  • packages/auth-ui/src/svelte/SignUpCard.svelte
  • packages/auth-ui/src/vue/AuthView.vue
  • packages/auth-ui/src/vue/SignInCard.vue
  • packages/auth-ui/src/vue/SignUpCard.vue

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@netlify

netlify Bot commented Aug 2, 2026 •

Copy link
Copy Markdown

❌ Deploy Preview for lunorash failed.

Name Link
🔨 Latest commit 30dd1ba
🔍 Latest deploy log https://app.netlify.com/projects/lunorash/deploys/6a6f0c1c7f06150008e8c4fe

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Thank you for confirming the Contributor License Agreement! 🙏

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@codspeed

codspeed Bot commented Aug 2, 2026

Copy link
Copy Markdown

This PR has no benchmarks

⚠️ No benchmarks were detected in both the base of the PR and the PR.
Please ensure that your benchmarks are correctly instrumented with CodSpeed.

Check out the benchmarks creation guide


Comparing fix/auth-ui-route-lookup-guard (30dd1ba) with alpha (6a4dd72)

Open in CodSpeed

@prisis

prisis commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

Closing: this PR was opened in error by an automated run, outside the scope of its task.

No work is lost — the branch is retained on origin and this PR can be reopened at any time.

Context: this branch predates the merges of #288 and #289, so much of its content is already on alpha, and it would need a rebase before being reviewable. Reopening deliberately, after a rebase, is preferable to leaving it open in this state.

@prisis prisis closed this Aug 2, 2026
@prisis
prisis deleted the fix/auth-ui-route-lookup-guard branch August 2, 2026 09:47
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using our GitHub Discussions tab for questions.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 8, 2026

This branch was previously deployed

1 inactive deployment
benchmarks — 30dd1baa Deployed Aug 2, 2026 by prisis via Benchmarks #1370
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant