senlinjun
aab8a004ae
feat(web): add API-key authentication for the REST API
...
- api_keys table + hashed key store (src/data/api-keys.ts), tsmb_-prefixed
plaintext shown once, per-user cap of 20, lastUsedAt tracking
- requireAuth accepts Authorization: Bearer / X-API-Key headers as an
alternative to the session cookie; key inherits the owner user's
role/capabilities/bot scope
- csrf origin check skipped for key-only requests (no ambient credentials);
requests that also carry the session cookie stay gated
- /api/keys management endpoints (session-only, guests excluded, keys
themselves rejected) with audit logging
- user deletion / password reset cascade-revoke the user's keys
- Settings page: API key management section (create/copy-once/revoke)
- docs: README section + full endpoint reference in docs/API.md
2026-09-29 21:51:43 +08:00
saopig1 and Claude Opus 4.8
c9a0719128
feat(auth): guest-aware requireAuth + disable invalidates guest sessions
...
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-25 11:25:26 +08:00
saopig1 and Claude Opus 4.8
696b224f8d
feat(perm): load capabilities + bot access onto req.user; expose via /me
...
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-05-30 13:21:24 +08:00
saopig1 and Claude Opus 4.8
554501cc74
feat(perm): requirePermission + requireBotAccess middleware
...
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-05-30 13:10:39 +08:00
saopig1 and Claude Opus 4.7
a73f797bcb
feat(auth): two-role permission system (admin/member)
...
Adds an admin/member role to WebUI auth. /api/users and /api/audit
are now gated by a requireAdmin middleware; all other authenticated
endpoints accept both roles. Schema migration defaults all existing
users to admin to preserve access. POST /api/users defaults new users
to member; first-run setup always creates an admin. Adds PATCH
/api/users/:id/role with last-admin demotion and deletion guards.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-05-27 15:35:15 +08:00
saopig1 and Claude Sonnet 4.6
ceb24595e6
fix(auth): race-safe first-run setup + rolling cookie max-age refresh
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-05-27 14:54:19 +08:00
saopig1 and Claude Sonnet 4.6
17c11f0512
feat(auth): add requireAuth middleware
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-05-27 13:36:26 +08:00