fix: harden authentication and revoke stale sessions

This commit is contained in:
xpp committed 2026-10-21 22:05:43 +08:00
1 parent c716ec7478
commit d994ffb9a5
14 files changed
+373 -29

No files matched your search

@@ -69,7 +69,7 @@ moyi:
secure-cookie: ${AUTH_SECURE_COOKIE:false}
bootstrap:
admin-account: ${ADMIN_ACCOUNT:adimin}
admin-password: ${ADMIN_PASSWORD:admin123}
admin-password: ${ADMIN_PASSWORD:}
admin-display-name: ${ADMIN_DISPLAY_NAME:平台管理员}
credentials:
encryption-key: ${CREDENTIAL_ENCRYPTION_KEY:}
@@ -0,0 +1,8 @@
-- Shared across replicas. Raw accounts, IPs and passwords are never written here.
CREATE TABLE auth_login_windows (
bucket_hash varchar(64) PRIMARY KEY CHECK (bucket_hash ~ '^[0-9a-f]{64}$'),
window_started_at timestamptz NOT NULL DEFAULT clock_timestamp(),
expires_at timestamptz NOT NULL DEFAULT (clock_timestamp()+interval '60 seconds'),
attempts integer NOT NULL CHECK (attempts BETWEEN 1 AND 1000)
);
CREATE INDEX auth_login_windows_expiry_idx ON auth_login_windows(expires_at);