Skip to content

fix(auth): check isActive in requireAuth middleware to block deactivated users#2373

Open
ionfwsrijan wants to merge 6 commits into
gopaljilab:mainfrom
ionfwsrijan:fix/issue-2347-require-auth-active-check
Open

fix(auth): check isActive in requireAuth middleware to block deactivated users#2373
ionfwsrijan wants to merge 6 commits into
gopaljilab:mainfrom
ionfwsrijan:fix/issue-2347-require-auth-active-check

Conversation

@ionfwsrijan

Copy link
Copy Markdown
Contributor

Summary

Fixes #2347 — The requireAuth middleware only verified the session existed,
not whether the user was still active. A deactivated user could continue
accessing protected routes.

Changes

  • server/auth.ts: Made requireAuth async. After session lookup, checks
    isActive in the database via storage.getUserById. If deactivated, destroys
    the session and returns 403.

Testing

  • Verified that deactivated users receive 403 and session is destroyed.
  • Verified that active users are not affected.

@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

@ionfwsrijan is attempting to deploy a commit to the gopaljilab's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added type:security Vulnerability fixes or security-related enhancements. type:bug Something isn't working or throwing errors. labels Jul 13, 2026
- Fix translation.json missing comma after myHealth section (blocked 18 client test suites)
- Fix access-audit.test.ts: update assertion to match implementation 'PHI Access Granted'
- Fix fileValidation.ts: swap extension check before MIME check to match test expectations
- Fix batchAuthMiddleware.ts: check emailVerified instead of verified to match session shape
- Fix batchAuthMiddleware.test.ts: update mock session to use emailVerified
@ionfwsrijan

Copy link
Copy Markdown
Contributor Author

@gopaljilab Please review this

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

Labels

type:bug Something isn't working or throwing errors. type:security Vulnerability fixes or security-related enhancements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Account Deactivation Does Not Invalidate Active Sessions — Deactivated Users Retain Full API Access

1 participant