feat: add independent Bell authentication and RBAC (#12)

This commit is contained in:
QiuSW
2026-08-12 17:44:31 +08:00
parent a5d846a437
commit a5fc8f5490
28 changed files with 840 additions and 22 deletions
+12
View File
@@ -16,6 +16,8 @@ Exact upstream sources and retained MIT notices are in `LICENSES/`.
Copy variable names from `.env.example` into the process environment. Replace every placeholder at deployment time. Bell intentionally has no built-in database password, session secret or administrator password.
`BELL_SESSION_SECRET` is mandatory, must be at least 32 characters, and must be generated independently from Sense. In production Bell marks its `bell_session` cookie as Secure, HttpOnly and SameSite=Strict.
The PostgreSQL role used by `BELL_DATABASE_URL` must be dedicated to Bell. Do not reuse a Sense role or database.
## Backend
@@ -27,6 +29,16 @@ go run . migrate
go run . serve
```
Create the first administrator only through a one-time process environment value; do not place the password in shell history, source files or command arguments:
```powershell
$env:BELL_BOOTSTRAP_PASSWORD = Read-Host -AsSecureString | ConvertFrom-SecureString -AsPlainText
go run . create-admin --username bell-admin --display-name "Bell 管理员"
Remove-Item Env:BELL_BOOTSTRAP_PASSWORD
```
Passwords require at least 12 characters with upper-case, lower-case and numeric characters. Bell ships no user or default password. Administrator, operator and viewer roles are seeded with least-privilege permissions; only an administrator can read user and authentication-audit pages.
Health endpoints:
```powershell