fix(security): revoke sessions on credential change (SUM-SEC-02) - #88
Merged
CHINMAYVIVEK merged 8 commits intoSep 7, 2026
Merged
Conversation
…UM-SEC-02) Delete all sys.session rows for a user after a successful password hash write or when core.user.active is set to false, so stolen cookies cannot survive admin password reset or account deactivation.
Avoid applog.Fatal on bad SUMERU_TEST_DSN by pinging before InitDBWithPool.
Session resolution JOINs core.user and requires active=true; inactive or expired sessions are deleted and the cookie is cleared. Includes integration tests and removes SUM-SEC-02 scope from this branch.
Avoid applog.Fatal on bad SUMERU_TEST_DSN by pinging before InitDBWithPool.
Merge dev reintroduced core/orm/session_revoke.go while the function already lives in user_password.go (SUM-SEC-02), breaking go vet/build. Co-authored-by: Cursor <cursoragent@cursor.com>
CHINMAYVIVEK
approved these changes
Sep 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DestroySessionsForUserin ORM and call it after successful password hash writes viaSetUserPasswordHashUpdateRecordByIDsetscore.user.activeto false (covers archive/deactivate flows)Fixes SUM-SEC-02 (CWE-613). Complements SUM-SEC-01: this deletes session rows proactively; SUM-SEC-01 rejects stale cookies on the next request.
Test plan
go test ./core/orm/... ./test/core/orm/... -count=1go test -tags integration ./test/core/orm/... -count=1(compile check)SUMERU_TEST_DSN='postgres://...' go test -tags integration ./test/core/orm/... -run 'TestPasswordChangeRevokesSessions|TestDeactivateUserRevokesSessions' -count=1