Skip to content

fix(session): follow-ups to the database session driver - #406

Merged
techmahedy merged 2 commits into
4.xfrom
fix/session-database-driver-followups
Nov 12, 2026
Merged

techmahedy merged 2 commits into
4.xfrom
fix/session-database-driver-followups

Conversation

@abdulmajidcse

@abdulmajidcse abdulmajidcse commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Follow-ups to #400. Docs: doppar/docs#125.

Changes

Fix: password recorded wrongly by withoutHook()->update()

When hooks are off, Authable::update() recorded the raw password value passed in as the device's pending password. Model::update() stores the value through setAttribute(), which trims it (sanitize()) and applies any #[Cast] set-cast. If the two differed, the pending fingerprint didn't match the saved hash, and AuthenticateSession signed out the device that had just changed its own password.

The value is now normalised the same way setAttribute() does before it is recorded.

session:table --uuid

The generated migration used a big-integer user_id, which breaks session writes for apps with UUID or ULID user keys on MySQL and PostgreSQL. php pool session:table --uuid now generates string('user_id', 36). The default is unchanged.

Docblock

The Authenticate::sessions() docblock said "other devices", but the list includes the current one (is_current).

Tests

  • New: test_a_password_updated_without_hooks_is_recorded_as_the_model_stores_it. It fails without the fix.
  • New: session:table default and --uuid column tests.
  • DatabaseStoreTest::migrate() now fills in the new {{ user_id }} placeholder.
  • Full suite on PHP 8.5 (SQLite): 6160 tests pass. The MySQL, PostgreSQL and Redis tests were skipped locally because those services weren't available.

- Record the stored password hash when a password is changed with
  withoutHook()->update(). The raw value was recorded before, but the
  model trims and casts it on save, so the device that changed its own
  password could be signed out by AuthenticateSession.
- Add a --uuid option to session:table that generates a string(36)
  user_id column for apps with UUID or ULID user keys.
- Correct the sessions() docblock: the list includes the current device.
- Add upgrade notes for the database driver and AuthenticateSession.

@techmahedy techmahedy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert the changelog, this will auto update after releasing, update the docs carefully

@abdulmajidcse

abdulmajidcse commented Nov 12, 2026 •

Copy link
Copy Markdown
Member Author

@techmahedy Thanks for the review. Both points are addressed:

The rest was already covered in the docs (old sessions signed out once, the default-actor limit, sessions() including the current device), so I left it as is.

Could you take another look?

@techmahedy techmahedy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the issues. Looks good now

@techmahedy
techmahedy merged commit 3e8f205 into 4.x Nov 12, 2026
14 checks passed
@techmahedy
techmahedy deleted the fix/session-database-driver-followups branch November 12, 2026 15:44
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.

2 participants