Skip to content

fix(auth): stop signin auth-watcher from racing navigation past validate() - #4534

Merged
PierreBrisorgueil merged 2 commits into
masterfrom
fix/4533-signin-explicit-navigation
Aug 3, 2026
Merged

fix(auth): stop signin auth-watcher from racing navigation past validate()#4534
PierreBrisorgueil merged 2 commits into
masterfrom
fix/4533-signin-explicit-navigation

Conversation

@PierreBrisorgueil

@PierreBrisorgueil PierreBrisorgueil commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Scope

  • Modules impacted: auth
  • Cross-module impact: none
  • Risk level: low

Validation

  • npm run lint
  • npm run test:unit
  • npm run build
  • Manual checks done (if applicable)

Guardrails check

  • No secrets or credentials introduced (.env*, secrets/**, keys, tokens)
  • No risky rename/move of core stack paths
  • Changes remain merge-friendly for downstream projects
  • Tests added or updated when behavior changed

Notes for reviewers

  • Security considerations: The open-redirect guard (redirect.startsWith('/')) is preserved byte-for-byte — only the trigger point for navigation moved, not the redirect validation logic.
  • Mergeability considerations: New real-Pinia-store regression suite (auth.signin.view.race.unit.tests.js) covers 4 scenarios: default route, redirect-query, non-/-prefixed redirect ignored (open-redirect guard), and failed signin (no navigation).
  • Follow-up tasks (optional): none

…ate()

watch.auth was the sole navigator on signin: it pushed the redirect
route as soon as signin() flipped authStore.auth to true. That
pre-flush watcher job lands on an earlier microtask than validate()'s
own `await authStore.signin()` continuation, decoupling navigation
from the flow that triggered it. Any future step added after the
awaited signin() (MFA challenge, forced password rotation, consent
interstitial) would be silently skipped before it could run -
reproducing #4437's bug class (fixed for signup in #4528) on this view.

Moves navigation into validate()'s success path, explicitly after
authStore.signin() resolves and authStore.auth is true, preserving the
redirect-query behavior byte-for-byte (including the startsWith('/')
open-redirect guard). Removes the now-unused watch.auth handler and
auth computed. OAuth's full-page href redirects (handled in created())
are unaffected.

Adds a regression suite that runs the real Pinia auth store (the
existing suite mocks a static { auth: false } store, so the watcher
never fired and the race was untested) covering the default-route
branch, the redirect-query branch, the non-"/"-prefixed redirect guard,
and the failed-signin (no navigation) branch.

Closes #4533
Cuts the fill-email/fill-password/validate/flushPromises sequence that
repeated verbatim across all 4 tests into one submitSignin() helper.
Keeps each scenario as its own named it() block (each documents a
distinct, security-relevant redirect case) rather than collapsing into
a test.each table.
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 17 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

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: ASSERTIVE

Plan: Pro Plus

Run ID: 92025598-db1c-4f79-afac-35bbf612848b

📥 Commits

Reviewing files that changed from the base of the PR and between ea3e6b9 and c1a680a.

📒 Files selected for processing (2)
  • src/modules/auth/tests/auth.signin.view.race.unit.tests.js
  • src/modules/auth/views/signin.view.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.

@PierreBrisorgueil
PierreBrisorgueil marked this pull request as ready for review August 3, 2026 12:36
@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.58%. Comparing base (ea3e6b9) to head (c1a680a).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4534   +/-   ##
=======================================
  Coverage   99.58%   99.58%           
=======================================
  Files          37       37           
  Lines        1457     1457           
  Branches      455      455           
=======================================
  Hits         1451     1451           
  Misses          6        6           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@PierreBrisorgueil

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 17 minutes.

@PierreBrisorgueil
PierreBrisorgueil merged commit 0addeb9 into master Aug 3, 2026
7 checks passed
@PierreBrisorgueil
PierreBrisorgueil deleted the fix/4533-signin-explicit-navigation branch August 3, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 fix(auth): signin navigates via watch.auth — same racy pattern removed from signup in #4437

1 participant