Rate limit account authentication attempts
This commit is contained in:
@@ -71,6 +71,14 @@ def initialize_database() -> None:
|
||||
CREATE INDEX IF NOT EXISTS idx_auth_sessions_user
|
||||
ON auth_sessions(user_id, expires_at);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS auth_rate_limits (
|
||||
scope TEXT NOT NULL,
|
||||
fingerprint TEXT NOT NULL,
|
||||
window_started_at INTEGER NOT NULL,
|
||||
attempts INTEGER NOT NULL CHECK(attempts >= 0),
|
||||
PRIMARY KEY(scope, fingerprint)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS conversations (
|
||||
id TEXT PRIMARY KEY,
|
||||
user_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
|
||||
Reference in New Issue
Block a user