Skip to content

Commit dc37c53

Browse files
authored
Merge pull request #20020 from mozilla/fxa-13013-add-otp-sec-event-names
feat(db): add migration for security event names
2 parents 715433b + 251666a commit dc37c53

4 files changed

Lines changed: 36 additions & 1 deletion

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
-- Add security event names for passwordless authentication
2+
-- These events track the passwordless login flow including OTP sending,
3+
-- verification, failures, and new account registration
4+
5+
SET NAMES utf8mb4 COLLATE utf8mb4_bin;
6+
7+
CALL assertPatchLevel('183');
8+
9+
INSERT INTO securityEventNames (name) VALUES
10+
('account.passwordless_login_otp_sent'),
11+
('account.passwordless_login_otp_failed'),
12+
('account.passwordless_login_otp_verified'),
13+
('account.passwordless_registration_complete');
14+
15+
UPDATE dbMetadata SET value = '184' WHERE name = 'schema-patch-level';
16+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-- Remove security event names for passwordless authentication
2+
3+
-- SET NAMES utf8mb4 COLLATE utf8mb4_bin;
4+
5+
-- CALL assertPatchLevel('184');
6+
7+
-- DELETE FROM securityEventNames WHERE name IN (
8+
-- 'account.passwordless_login_otp_sent',
9+
-- 'account.passwordless_login_otp_failed',
10+
-- 'account.passwordless_login_otp_verified',
11+
-- 'account.passwordless_registration_complete'
12+
-- );
13+
14+
-- UPDATE dbMetadata SET value = '183' WHERE name = 'schema-patch-level';
15+
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"level": 183
2+
"level": 184
33
}

packages/fxa-shared/db/models/auth/security-event.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ export const EVENT_NAMES: Record<string, number> = {
7272
'account.passkey.removed': 53,
7373
'account.passkey.authentication_success': 54,
7474
'account.passkey.authentication_failure': 55,
75+
'account.passwordless_login_otp_sent': 56,
76+
'account.passwordless_login_otp_failed': 57,
77+
'account.passwordless_login_otp_verified': 58,
78+
'account.passwordless_registration_complete': 59,
7579
} as const;
7680

7781
export type SecurityEventNames = keyof typeof EVENT_NAMES;

0 commit comments

Comments
 (0)