Skip to content

fix(auth): read ban and deletion live on every authenticated request - #150

Merged
kipavy merged 1 commit into
mainfrom
fix/ban-ends-sessions
Nov 15, 2026
Merged

kipavy merged 1 commit into
mainfrom
fix/ban-ends-sessions

Conversation

@kipavy

@kipavy kipavy commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

authenticate now reads the account's ban flag and deleted_at in the same query as the login-session liveness check it already ran per request (one query, sid-less tokens included), and overrides the token's is_banned claim with the live value:

  • a ban answers 403 banned on the next request instead of after the next refresh; an unban applies immediately the same way
  • a soft-deleted account gets 401 on the next request
  • ban_user and the admin soft delete call notify_sessions_reset, so the user's open sync streams and terminal sockets close

Tests: new cases in routes::auth and routes::admin; two middleware tests moved from a dead pool to a seeded user since the middleware now always reads the account. Full suite and clippy clean.

The access token's is_banned claim is fixed at issue time, so a ban or an
admin soft-delete only took effect at the next refresh. authenticate now
reads the account's standing together with the login session check, and
ban / soft-delete close the user's open streams and sockets.
@kipavy
kipavy merged commit fc9414d into main Nov 15, 2026
1 check passed
@kipavy
kipavy deleted the fix/ban-ends-sessions branch November 15, 2026 19:55
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