Commit Graph
22 Commits
Author SHA1 Message Date
naibaandcloudcode e05700c2f0 feat(jwt): server-side session table with keyId + obfuscated uid claims
Replace the {user_id, ip} claim pair with {keyId, uid}:
- keyId is a 32-byte random id that points to a row in the new
  jwt_sessions table holding the real user id, bound IP, UA hash,
  TokenVersion and expiry.
- uid is the user id encoded through pkg/idcodec; mismatch between
  claim uid and session.UserID trips WAF block on the caller IP.
- identityHandler now rejects unknown/revoked/expired sessions, IP
  drift and stale TokenVersion. Refresh updates session.ExpiresAt.

User.TokenVersion bumps on password change and revokes outstanding
sessions, so a leaked JWT secret alone is no longer enough to forge
a token. JWTSession rows are GC'd every 10 minutes (expired + grace
or revoked >24h). OAuth2 callback shares the same issue path.

Includes regression tests for happy path, mismatched claim uid,
revoked session, TokenVersion bump, IP drift and unknown keyId.

Co-authored-by: cloudcode <cloudcode@users.noreply.github.com>
2026-05-26 03:51:05 +00:00
UUBulb 010ae7ef51 fix: member-created services shouldn't be applied to admin resources (#1113) 2025-08-28 22:37:44 +08:00
UUBulb 1131f84385 fix: update user cache after profile updates (#936) 2025-01-01 16:11:10 +08:00
UUBulb 3d591fae78 fix: struct tag (#932)
* fix: struct tag

* fix: struct tag

* fix: strings conversion

* do not write anything after redirection

* fix table

* fix select
2024-12-31 23:09:58 +08:00
UUBulb 2d03c61f38 fix: oauth2 redirect url not consistent (#930)
* fix: oauth2 redirect url not consistent

* only use one redirect uri

* feat: allow to disable password authentication

* generate translation template

* update error

* redirect

* query
2024-12-31 22:29:29 +08:00
naiba 8b9afbf39c feat: 绑定 oauth2 2024-12-28 23:50:59 +08:00
naiba 0b54aa070d feat: block user manual & upgrade frontend 2024-12-23 19:50:41 +08:00
naiba eaf57ec1ab chore: api doc 2024-12-22 23:20:49 +08:00
naiba 0764dac3b3 refactor: improve performance 2024-12-22 17:23:55 +08:00
naiba ea43234797 fix: create user form 2024-12-22 15:51:37 +08:00
naiba 6dea3e19d2 feat: list & block online users 2024-12-22 01:08:07 +08:00
UUBulb dc0132c9aa feat: user roles (#852)
* [WIP] feat: user roles

* update

* update

* admin handler

* update

* feat: user-specific connection secret

* simplify some logics

* cleanup

* update waf

* update user api error handling

* update waf api

* fix codeql

* update waf table

* fix several problems

* add pagination for waf api

* update permission checks

* switch to runtime check

* 1

* cover?

* some changes
2024-12-22 00:05:41 +08:00
naiba dd964f3b26 feat: multi user template 2024-12-06 23:19:28 +08:00
naiba bbcfd6a83b feat: 支持修改用户名 2024-11-30 15:05:46 +08:00
naiba a7e4fe0909 rename repo 2024-11-28 19:38:54 +08:00
UUBulb 4fed62db46 send country code in ws, update profile api (#22)
* send country code in ws

* make ddns_profiles optional field

* update profile api
2024-11-26 21:30:56 +08:00
naiba 116a56868f fix: update release workflow repository and enhance user deletion logic 2024-11-25 22:24:33 +08:00
UUBulb e465134c11 update profile api (#16)
* update profile api

* rename

* fix realip assertion

* add waf api
2024-11-23 16:22:22 +08:00
naiba 323f4d25c2 feat: profile api 2024-11-03 23:28:10 +08:00
uubulb d56224a118 feat: add i18n support 2024-11-01 05:07:04 +08:00
naiba dd41017634 💄 refactor common handler 2024-10-23 17:56:51 +08:00
naiba c706950ecc feat: create user, read users, batch delete users 2024-10-22 21:19:30 +08:00