SlideShare una empresa de Scribd logo
1 de 43
Descargar para leer sin conexión
Migrating 30k bank
users - what can
possibly go wrong?
Anna Skawińska
Anna Skawińska
Node.js Team Manager,
Senior Node.js Developer @TSH
also: mom of 2, wife, self-taught musician,
constant learner and doer, dad joke professional
Agenda
The Masterplan
2
The Challenge
1
The Reality
3
Lessons learned
4
The Challenge
Greenfield app
Cognito User Pool
● email used as username
● email used as password recovery method
● phone number used as MFA method
● so: both required
Backend
Legacy app
● blackbox
● > 26 000 users
Migration of logins
logins
Greenfield app
banking data
● 3 months on prod
● for new customers only
● < 100 users
Cloud-native
backend
Legacy app
Two customers, one login
Two customers, one login
ID USERNAME PASSWORD
123456 AA_SMITH 0x49FE91D153D79C57FA3EC25E1BB762EE9527313E7F02060E281AA36F5B6AE4E2
423454 AA23456 0x49FE91D153D79C57FA3EC25E1BB762EE9527313E7F02060E281AA36F5B6AE4E2
423455 AB23456 0x49FE91D153D79C57FA3EC25E1BB762EE9527313E7F02060E281AA36F5B6AE4E2
LOGIN_ID FIRST_NAME LAST_NAME DATE_OF_BIRTH CUSTOMER_ID PHONE EMAIL
123456 Mrs Smith 01-01-1985 XXXXX null null
123456 Mr Smith 06-06-1980 YYYYY null null
Logins
Customers
The Masterplan
Extract logins to DynamoDB
username,
password,
date of birth,
old customer ID
Extract
Create
Join
DynamoDB
Denormalize Logins using dateOfBirth
USERNAME PASSWORD DATE_OF_BIRTH NEW_CUSTOMER_ID
AA_SMITH
0x49FE91D153D79C57FA3EC25E1BB762EE9527313E7F02060E281AA36F5B6AE4E2
01-01-1985 0010E00001IfPmYQAV
AA_SMITH
0x49FE91D153D79C57FA3EC25E1BB762EE9527313E7F02060E281AA36F5B6AE4E2
06-06-1980 0010E00001GgxM2QAJ
How to load it to Cognito?
✅ transparent to the users
❌ email missing - mandatory in our Cognito (alias and recovery method)
❌ phone missing - mandatory in our Cognito (MFA method)
Bulk import?
Migrate User Lambda trigger?
SignIn:
username/
password
user doesn’t
exist?
external user
directory
import username/
password
Migrate User Lambda - code
exports.handler = (event, context, callback) => {
var user;
if ( event.triggerSource == "UserMigration_Authentication" ) {
// authenticate the user with your existing user directory service
user = authenticateUser(event.userName, event.request.password);
if ( user ) {
storeCustomerId(event.userName, user.customerId);
event.response.userAttributes = {
"email": event.request.validationData.email,
"phone_number": event.request.validationData.phone_number,
};
event.response.finalUserStatus = "CONFIRMED";
event.response.messageAction = "SUPPRESS";
context.succeed(event);
}
else {
// Return error to Amazon Cognito
callback("Bad password");
}
}
};
But: password policy
Legacy app:
#yolo xD
Cognito:
Policies:
PasswordPolicy:
MinimumLength: 12
RequireLowercase: true
RequireNumbers: true
RequireSymbols: true
RequireUppercase: true
But: password policy..?
🤔
󰣼
🙀
⁉
Password policy 2021 vs 2022
✅ may be transparent to the user
✅ first sign in: custom authentication against pre-migrated logins
✅ ValidationData, ClientMetadata: user could add phone, email address…
❌ 2021: Password Policy applied on legacy passwords
✅ 2022: Password Policy no longer applied on legacy passwords!
Migrate User Lambda trigger?
The Masterplan
First SignUp…
…then check legacy login
SignUp: email,
password, phone…
ConfirmSignUp
(verify email)
InitiateAuth
GraphQL: migrateLegacyUser(
oldUsername, oldPassword,
dateOfBirth)
verifyLegacyLogin(
oldUsername, oldPassword,
dateOfBirth)
new UserId ⇒ new CustomerId
RespondToAuthChallenge
(MFA => verify phone)
How to do it securely?
● What if it leaks out?
● Oh, it’s just temp!
USERNAME PASSWORD DATE_OF_BIRTH NEW_CUSTOMER_ID
AA_SMITH
0x49FE91D153D79C57FA3EC25E1BB762EE9527313E7F02060E281AA36F5B6AE4E2
01-01-1985 0010E00001IfPmYQAV
AA_SMITH
0x49FE91D153D79C57FA3EC25E1BB762EE9527313E7F02060E281AA36F5B6AE4E2
06-06-1980 0010E00001GgxM2QAJ
superCoolHashingFunction!
PK NEW_CUSTOMER_ID
a883a161f49e38d70bc17e0915d2faf0da58aaef7352f2204fdc916969d36cc69f9d
374cf764e210687633001bd6ac25d2bcbaf695e0e6ebb20893fa1f5603ac 0010E00001GgxM2QAJ
● This Dynamo table stays for the verifyLegacyLogin Lambda
SuperCoolHashingFunction
async generateHash(username: string, passwordHash: string, dateOfBirth: string) {
// So that identical passwords have unique hash:
const salt = `${username}#${dateOfBirth}`;
const hash = await this.hashWithSalt(passwordHash, salt);
// So that a leaked hash table can't be reverse engineered:
const pepperedHash = await this.hashWithSalt(hash, this.options.passwordSalt);
return pepperedHash;
}
The Reality
● check with test data:
○ generate fake credentials + date of birth, store in DDB, automate
○ worked (repeatedly) ✅
● check with a couple of “friendly” customers (knowing their passwords upfront)
○ worked ✅
So far, so good
Day 0
SMS Quota
● 7.5k people * $0.1189 / SMS ≈ $900
● quota at the time?
● $100…
● raised to $1000 right away
● enough for how long..?
UX failure #1: “Sign up” vs “Migrate”
● target group: 60+
● missed the “already have an account?” question
● solution: “sign in” is now on a different landing page than
“sign up”
UX failure #2 - no validation on username
● no prior idea of what usernames look like
● (black box)
● temp migration table only accessed by the Bank’s internal
employee
Security failure
● Customer: “password doesn’t work”
● …Engineers: added “reveal password” feature
● Customer: “password doesn’t work”
● CTO + Engineer on the line
● Customer, CTO, Engineer: “password doesn’t work”
● guessing game, reverse engineering legacy system…
● …
● …legacy system cropped long passwords
● solution: why not crop, too 🙈 (migration step only)
Lessons learned
Expect the unexpected
● UI changes on demand!
Expect a peak right after announcement
● expect a massive peak on the first day / week after the announced migration
● calculate the monthly quotas accordingly
● you can lower them after the first month
Lambda autoscaling worked like a charm
● there was no need for provisioned concurrency
● peak traffic gracefully handled
Migration Lambda Trigger - weak passwords work now!
● The Out-of-the-box AWS Cognito functionality would work now
● you can forget this presentation now 󰤆
tsh.io
Thank you for your attention.
Miłej środy!

Más contenido relacionado

Similar a Zmigrujmy 30 tys. użytkowników ze starego systemu. Co może pójść nie tak?

Providing security to online banking Project Presentation-3.pptx
Providing security to online banking Project Presentation-3.pptxProviding security to online banking Project Presentation-3.pptx
Providing security to online banking Project Presentation-3.pptx
SanviSanvi11
 
Amol Chillarge Asp.net C# developer and Tester
Amol Chillarge Asp.net C# developer and TesterAmol Chillarge Asp.net C# developer and Tester
Amol Chillarge Asp.net C# developer and Tester
Amol Chillarge
 
Bhaurao 2+ Experience in Node.js
Bhaurao 2+ Experience in Node.jsBhaurao 2+ Experience in Node.js
Bhaurao 2+ Experience in Node.js
Bhaurao Birajdar
 

Similar a Zmigrujmy 30 tys. użytkowników ze starego systemu. Co może pójść nie tak? (20)

Mozilla Persona for your domain
Mozilla Persona for your domainMozilla Persona for your domain
Mozilla Persona for your domain
 
How I Built Bill, the AI-Powered Chatbot That Reads Our Docs for Fun , by Tod...
How I Built Bill, the AI-Powered Chatbot That Reads Our Docs for Fun , by Tod...How I Built Bill, the AI-Powered Chatbot That Reads Our Docs for Fun , by Tod...
How I Built Bill, the AI-Powered Chatbot That Reads Our Docs for Fun , by Tod...
 
Providing security to online banking Project Presentation-3.pptx
Providing security to online banking Project Presentation-3.pptxProviding security to online banking Project Presentation-3.pptx
Providing security to online banking Project Presentation-3.pptx
 
Resume Salmaan Ahamed AM
Resume Salmaan Ahamed AMResume Salmaan Ahamed AM
Resume Salmaan Ahamed AM
 
Kym - GoJek GoPay integration
Kym - GoJek GoPay integration Kym - GoJek GoPay integration
Kym - GoJek GoPay integration
 
UX Strategy and The Questions; UX in AZ Meetup, May 2019
UX Strategy and The Questions; UX in AZ Meetup, May 2019UX Strategy and The Questions; UX in AZ Meetup, May 2019
UX Strategy and The Questions; UX in AZ Meetup, May 2019
 
Are API Services Taking Over All the Interesting Data Science Problems?
Are API Services Taking Over All the Interesting Data Science Problems?Are API Services Taking Over All the Interesting Data Science Problems?
Are API Services Taking Over All the Interesting Data Science Problems?
 
Ankita kumthekar
Ankita kumthekarAnkita kumthekar
Ankita kumthekar
 
MongoDB World 2018: Decentralized Identity Management with Blockchain and Mon...
MongoDB World 2018: Decentralized Identity Management with Blockchain and Mon...MongoDB World 2018: Decentralized Identity Management with Blockchain and Mon...
MongoDB World 2018: Decentralized Identity Management with Blockchain and Mon...
 
Amol Chillarge Asp.net C# developer and Tester
Amol Chillarge Asp.net C# developer and TesterAmol Chillarge Asp.net C# developer and Tester
Amol Chillarge Asp.net C# developer and Tester
 
Building Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchBuilding Your First App with MongoDB Stitch
Building Your First App with MongoDB Stitch
 
Continuous delivery
Continuous deliveryContinuous delivery
Continuous delivery
 
Bhaurao 2+ Experience in Node.js
Bhaurao 2+ Experience in Node.jsBhaurao 2+ Experience in Node.js
Bhaurao 2+ Experience in Node.js
 
Stream me to the Cloud (and back) with Confluent & MongoDB
Stream me to the Cloud (and back) with Confluent & MongoDBStream me to the Cloud (and back) with Confluent & MongoDB
Stream me to the Cloud (and back) with Confluent & MongoDB
 
Kumar Kuppanna CV
Kumar Kuppanna CVKumar Kuppanna CV
Kumar Kuppanna CV
 
Nitin bondre
Nitin bondreNitin bondre
Nitin bondre
 
Easy logins for JavaScript web applications
Easy logins for JavaScript web applicationsEasy logins for JavaScript web applications
Easy logins for JavaScript web applications
 
Luke's portfolio
Luke's portfolioLuke's portfolio
Luke's portfolio
 
LoginCat - Zero Trust Integrated Cybersecurity
LoginCat - Zero Trust Integrated CybersecurityLoginCat - Zero Trust Integrated Cybersecurity
LoginCat - Zero Trust Integrated Cybersecurity
 
Mayank_Gupta
Mayank_GuptaMayank_Gupta
Mayank_Gupta
 

Más de The Software House

Más de The Software House (20)

Jak kraść miliony, czyli o błędach bezpieczeństwa, które mogą spotkać również...
Jak kraść miliony, czyli o błędach bezpieczeństwa, które mogą spotkać również...Jak kraść miliony, czyli o błędach bezpieczeństwa, które mogą spotkać również...
Jak kraść miliony, czyli o błędach bezpieczeństwa, które mogą spotkać również...
 
Uszanowanko Podsumowanko
Uszanowanko PodsumowankoUszanowanko Podsumowanko
Uszanowanko Podsumowanko
 
Jak efektywnie podejść do certyfikacji w AWS?
Jak efektywnie podejść do certyfikacji w AWS?Jak efektywnie podejść do certyfikacji w AWS?
Jak efektywnie podejść do certyfikacji w AWS?
 
O co chodzi z tą dostępnością cyfrową?
O co chodzi z tą dostępnością cyfrową?O co chodzi z tą dostępnością cyfrową?
O co chodzi z tą dostępnością cyfrową?
 
Chat tekstowy z użyciem Amazon Chime
Chat tekstowy z użyciem Amazon ChimeChat tekstowy z użyciem Amazon Chime
Chat tekstowy z użyciem Amazon Chime
 
Migracje danych serverless
Migracje danych serverlessMigracje danych serverless
Migracje danych serverless
 
Jak nie zwariować z architekturą Serverless?
Jak nie zwariować z architekturą Serverless?Jak nie zwariować z architekturą Serverless?
Jak nie zwariować z architekturą Serverless?
 
Analiza semantyczna artykułów prasowych w 5 sprintów z użyciem AWS
Analiza semantyczna artykułów prasowych w 5 sprintów z użyciem AWSAnaliza semantyczna artykułów prasowych w 5 sprintów z użyciem AWS
Analiza semantyczna artykułów prasowych w 5 sprintów z użyciem AWS
 
Feature flags na ratunek projektu w JavaScript
Feature flags na ratunek projektu w JavaScriptFeature flags na ratunek projektu w JavaScript
Feature flags na ratunek projektu w JavaScript
 
Typowanie nominalne w TypeScript
Typowanie nominalne w TypeScriptTypowanie nominalne w TypeScript
Typowanie nominalne w TypeScript
 
Automatyzacja tworzenia frontendu z wykorzystaniem GraphQL
Automatyzacja tworzenia frontendu z wykorzystaniem GraphQLAutomatyzacja tworzenia frontendu z wykorzystaniem GraphQL
Automatyzacja tworzenia frontendu z wykorzystaniem GraphQL
 
Serverless Compose vs hurtownia danych
Serverless Compose vs hurtownia danychServerless Compose vs hurtownia danych
Serverless Compose vs hurtownia danych
 
Testy API: połączenie z bazą danych czy implementacja w pamięci
Testy API: połączenie z bazą danych czy implementacja w pamięciTesty API: połączenie z bazą danych czy implementacja w pamięci
Testy API: połączenie z bazą danych czy implementacja w pamięci
 
Jak skutecznie read model. Case study
Jak skutecznie read model. Case studyJak skutecznie read model. Case study
Jak skutecznie read model. Case study
 
Firestore czyli ognista baza od giganta z Doliny Krzemowej
Firestore czyli ognista baza od giganta z Doliny KrzemowejFirestore czyli ognista baza od giganta z Doliny Krzemowej
Firestore czyli ognista baza od giganta z Doliny Krzemowej
 
Jak utrzymać stado Lambd w ryzach
Jak utrzymać stado Lambd w ryzachJak utrzymać stado Lambd w ryzach
Jak utrzymać stado Lambd w ryzach
 
Jak poskromić AWS?
Jak poskromić AWS?Jak poskromić AWS?
Jak poskromić AWS?
 
O łączeniu Storyblok i Next.js
O łączeniu Storyblok i Next.jsO łączeniu Storyblok i Next.js
O łączeniu Storyblok i Next.js
 
Amazon Step Functions. Sposób na implementację procesów w chmurze
Amazon Step Functions. Sposób na implementację procesów w chmurzeAmazon Step Functions. Sposób na implementację procesów w chmurze
Amazon Step Functions. Sposób na implementację procesów w chmurze
 
Od Figmy do gotowej aplikacji bez linijki kodu
Od Figmy do gotowej aplikacji bez linijki koduOd Figmy do gotowej aplikacji bez linijki kodu
Od Figmy do gotowej aplikacji bez linijki kodu
 

Último

%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Último (20)

WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 

Zmigrujmy 30 tys. użytkowników ze starego systemu. Co może pójść nie tak?

  • 1. Migrating 30k bank users - what can possibly go wrong? Anna Skawińska
  • 2. Anna Skawińska Node.js Team Manager, Senior Node.js Developer @TSH also: mom of 2, wife, self-taught musician, constant learner and doer, dad joke professional
  • 3. Agenda The Masterplan 2 The Challenge 1 The Reality 3 Lessons learned 4
  • 5.
  • 7. Cognito User Pool ● email used as username ● email used as password recovery method ● phone number used as MFA method ● so: both required
  • 8. Backend Legacy app ● blackbox ● > 26 000 users Migration of logins logins Greenfield app banking data ● 3 months on prod ● for new customers only ● < 100 users Cloud-native backend
  • 11. Two customers, one login ID USERNAME PASSWORD 123456 AA_SMITH 0x49FE91D153D79C57FA3EC25E1BB762EE9527313E7F02060E281AA36F5B6AE4E2 423454 AA23456 0x49FE91D153D79C57FA3EC25E1BB762EE9527313E7F02060E281AA36F5B6AE4E2 423455 AB23456 0x49FE91D153D79C57FA3EC25E1BB762EE9527313E7F02060E281AA36F5B6AE4E2 LOGIN_ID FIRST_NAME LAST_NAME DATE_OF_BIRTH CUSTOMER_ID PHONE EMAIL 123456 Mrs Smith 01-01-1985 XXXXX null null 123456 Mr Smith 06-06-1980 YYYYY null null Logins Customers
  • 12.
  • 14. Extract logins to DynamoDB username, password, date of birth, old customer ID Extract Create Join DynamoDB
  • 15. Denormalize Logins using dateOfBirth USERNAME PASSWORD DATE_OF_BIRTH NEW_CUSTOMER_ID AA_SMITH 0x49FE91D153D79C57FA3EC25E1BB762EE9527313E7F02060E281AA36F5B6AE4E2 01-01-1985 0010E00001IfPmYQAV AA_SMITH 0x49FE91D153D79C57FA3EC25E1BB762EE9527313E7F02060E281AA36F5B6AE4E2 06-06-1980 0010E00001GgxM2QAJ
  • 16. How to load it to Cognito?
  • 17. ✅ transparent to the users ❌ email missing - mandatory in our Cognito (alias and recovery method) ❌ phone missing - mandatory in our Cognito (MFA method) Bulk import?
  • 18. Migrate User Lambda trigger? SignIn: username/ password user doesn’t exist? external user directory import username/ password
  • 19. Migrate User Lambda - code exports.handler = (event, context, callback) => { var user; if ( event.triggerSource == "UserMigration_Authentication" ) { // authenticate the user with your existing user directory service user = authenticateUser(event.userName, event.request.password); if ( user ) { storeCustomerId(event.userName, user.customerId); event.response.userAttributes = { "email": event.request.validationData.email, "phone_number": event.request.validationData.phone_number, }; event.response.finalUserStatus = "CONFIRMED"; event.response.messageAction = "SUPPRESS"; context.succeed(event); } else { // Return error to Amazon Cognito callback("Bad password"); } } };
  • 20. But: password policy Legacy app: #yolo xD Cognito: Policies: PasswordPolicy: MinimumLength: 12 RequireLowercase: true RequireNumbers: true RequireSymbols: true RequireUppercase: true
  • 23. ✅ may be transparent to the user ✅ first sign in: custom authentication against pre-migrated logins ✅ ValidationData, ClientMetadata: user could add phone, email address… ❌ 2021: Password Policy applied on legacy passwords ✅ 2022: Password Policy no longer applied on legacy passwords! Migrate User Lambda trigger?
  • 27. SignUp: email, password, phone… ConfirmSignUp (verify email) InitiateAuth GraphQL: migrateLegacyUser( oldUsername, oldPassword, dateOfBirth) verifyLegacyLogin( oldUsername, oldPassword, dateOfBirth) new UserId ⇒ new CustomerId RespondToAuthChallenge (MFA => verify phone)
  • 28. How to do it securely? ● What if it leaks out? ● Oh, it’s just temp! USERNAME PASSWORD DATE_OF_BIRTH NEW_CUSTOMER_ID AA_SMITH 0x49FE91D153D79C57FA3EC25E1BB762EE9527313E7F02060E281AA36F5B6AE4E2 01-01-1985 0010E00001IfPmYQAV AA_SMITH 0x49FE91D153D79C57FA3EC25E1BB762EE9527313E7F02060E281AA36F5B6AE4E2 06-06-1980 0010E00001GgxM2QAJ superCoolHashingFunction! PK NEW_CUSTOMER_ID a883a161f49e38d70bc17e0915d2faf0da58aaef7352f2204fdc916969d36cc69f9d 374cf764e210687633001bd6ac25d2bcbaf695e0e6ebb20893fa1f5603ac 0010E00001GgxM2QAJ ● This Dynamo table stays for the verifyLegacyLogin Lambda
  • 29. SuperCoolHashingFunction async generateHash(username: string, passwordHash: string, dateOfBirth: string) { // So that identical passwords have unique hash: const salt = `${username}#${dateOfBirth}`; const hash = await this.hashWithSalt(passwordHash, salt); // So that a leaked hash table can't be reverse engineered: const pepperedHash = await this.hashWithSalt(hash, this.options.passwordSalt); return pepperedHash; }
  • 31. ● check with test data: ○ generate fake credentials + date of birth, store in DDB, automate ○ worked (repeatedly) ✅ ● check with a couple of “friendly” customers (knowing their passwords upfront) ○ worked ✅ So far, so good
  • 32. Day 0
  • 33. SMS Quota ● 7.5k people * $0.1189 / SMS ≈ $900 ● quota at the time? ● $100… ● raised to $1000 right away ● enough for how long..?
  • 34. UX failure #1: “Sign up” vs “Migrate” ● target group: 60+ ● missed the “already have an account?” question ● solution: “sign in” is now on a different landing page than “sign up”
  • 35. UX failure #2 - no validation on username ● no prior idea of what usernames look like ● (black box) ● temp migration table only accessed by the Bank’s internal employee
  • 36. Security failure ● Customer: “password doesn’t work” ● …Engineers: added “reveal password” feature ● Customer: “password doesn’t work” ● CTO + Engineer on the line ● Customer, CTO, Engineer: “password doesn’t work” ● guessing game, reverse engineering legacy system… ● … ● …legacy system cropped long passwords ● solution: why not crop, too 🙈 (migration step only)
  • 38. Expect the unexpected ● UI changes on demand!
  • 39. Expect a peak right after announcement ● expect a massive peak on the first day / week after the announced migration ● calculate the monthly quotas accordingly ● you can lower them after the first month
  • 40. Lambda autoscaling worked like a charm ● there was no need for provisioned concurrency ● peak traffic gracefully handled
  • 41. Migration Lambda Trigger - weak passwords work now! ● The Out-of-the-box AWS Cognito functionality would work now ● you can forget this presentation now 󰤆
  • 42. tsh.io Thank you for your attention.