CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
0078_login_attempts.sql
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| ba9e143 | 1 | -- Migration 0078: Login attempt tracking for account lockout (SOC 2 CC6.1). |
| 2 | -- Records failed login attempts per email+IP. After 10 failures in 1 hour, | |
| 3 | -- auth.login.locked is emitted and logins from that email are blocked for 15 min. | |
| 4 | ||
| 5 | CREATE TABLE IF NOT EXISTS login_attempts ( | |
| 6 | id uuid PRIMARY KEY DEFAULT gen_random_uuid(), | |
| 7 | email text NOT NULL, | |
| 8 | ip text NOT NULL, | |
| 9 | success boolean NOT NULL DEFAULT false, | |
| 10 | created_at timestamp NOT NULL DEFAULT now() | |
| 11 | ); | |
| 12 | ||
| 13 | CREATE INDEX IF NOT EXISTS login_attempts_email_created | |
| 14 | ON login_attempts (email, created_at); | |
| 15 | ||
| 16 | CREATE INDEX IF NOT EXISTS login_attempts_ip_created | |
| 17 | ON login_attempts (ip, created_at); |