Skip to content

fix(security): revoke sessions on credential change (SUM-SEC-02) - #88

Merged
CHINMAYVIVEK merged 8 commits into
devfrom
fix/SUM-SEC-02-revoke-sessions-on-credential-change
Sep 7, 2026
Merged

fix(security): revoke sessions on credential change (SUM-SEC-02)#88
CHINMAYVIVEK merged 8 commits into
devfrom
fix/SUM-SEC-02-revoke-sessions-on-credential-change

Conversation

@ATRIwOX

@ATRIwOX ATRIwOX commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add DestroySessionsForUser in ORM and call it after successful password hash writes via SetUserPasswordHash
  • Revoke all sessions when UpdateRecordByID sets core.user.active to false (covers archive/deactivate flows)
  • Add integration tests for both password change and deactivation paths
    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=1
  • go 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
  • Manual: log in from two browsers, reset password → old session cookie no longer authenticates
  • Manual: deactivate user → existing session cookie no longer authenticates

…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.
@ATRIwOX
ATRIwOX requested a review from CHINMAYVIVEK September 7, 2026 03:46
@ATRIwOX ATRIwOX self-assigned this Sep 7, 2026
@ATRIwOX
ATRIwOX requested a review from a team September 7, 2026 03:46
ATRIwOX and others added 7 commits September 7, 2026 10:28
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
CHINMAYVIVEK merged commit 1ae498f into dev Sep 7, 2026
6 checks passed
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