Skip to content

fix: [Bug] Fix nonce validation race condition due to concurrent PHP session ... - #25124

Open
Roshan931 wants to merge 1 commit into
matomo-org:6.x-devfrom
Roshan931:prilog/fix-error-db-session-save-handler-overwrites-08-21-2026-4d395c
Open

fix: [Bug] Fix nonce validation race condition due to concurrent PHP session ...#25124
Roshan931 wants to merge 1 commit into
matomo-org:6.x-devfrom
Roshan931:prilog/fix-error-db-session-save-handler-overwrites-08-21-2026-4d395c

Conversation

@Roshan931

Copy link
Copy Markdown

Fixes #24477

Root cause

DB session save handler overwrites session data with a stale snapshot (last-write-wins)

Changes

  • Piwik\Session\SaveHandler\DbTable now remembers the session payload it read at the start of the request and, on write, applies only the values this request actually changed on top of the session data currently stored. Unchanged sessions only refresh modified/lifetime instead of rewriting the data column, changed sessions are stored with a three-way merge (recursive per key, honouring keys the request removed) via a compare-and-swap UPDATE with a bounded retry, and any non-mergeable payload (unparsable data, objects in the session, no read snapshot) falls back to the previous plain write. Regression tests were added to the existing DbTable integration test.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Fix nonce validation race condition due to concurrent PHP session writes

1 participant