Skip to content

Restore session use in Auth\Manager::once() when authentication throws - #261

Open
austinderrick wants to merge 1 commit into
wintercms:wip/1.3from
austinderrick:fix/auth-once-restore-session
Open

austinderrick wants to merge 1 commit into
wintercms:wip/1.3from
austinderrick:fix/auth-once-restore-session

Conversation

@austinderrick

Copy link
Copy Markdown
Contributor

Summary

Auth\Manager::once() turns session persistence off, authenticates, and then sets useSession back to a hard-coded true. If authenticate() throws (for example, on a throttled or banned login), the reset never runs and the singleton keeps sessions disabled for the rest of the process. once() now restores the previous value in a finally block, which also keeps a subclass's own default instead of forcing true.

Under PHP-FPM this lasts until the end of the request. Under a persistent worker such as Laravel Octane it lasts for every later request.

Split out of #241 so it can be reviewed on its own.

Testing

tests/Auth/ManagerOnceTest.php covers a throwing authentication and restoring a previous false. The first test fails without the change.

once() turned session persistence off, authenticated, then turned it back on with a hard-coded true. An exception from authenticate() skipped the restore and left the singleton with sessions disabled for the rest of the process. It now restores the previous value in a finally block.
@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0c28c603-ad64-4cfe-8f2c-c84d3622cbb6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant