Add tracking for Phone Verification
What does this MR do and why?
This adds backend Snowplow tracking for phone verification https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/issues/78 & https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/issues/79, part of barriers to entry.
The following events are tracked:
-
An invalid code is entered
se_category: "IdentityVerification::Phone", se_action: "failed_attempt", se_property: "invalid_code",
-
The phone number was invalid
se_category: "IdentityVerification::Phone", se_action: "failed_attempt", se_property: "invalid_phone_number",
-
The attempt was rate limited
se_category: "IdentityVerification::Phone", se_action: "failed_attempt", se_property: "rate_limited",
-
A new code has been sent
se_category: "IdentityVerification::Phone", se_action: "sent_phone_verification_code",
-
The attempt was successful
se_category: "IdentityVerification::Phone", se_action: "success",
Screenshots or screen recordings
It's a little hard to take screenshots of Snowplow events, but here is one of the success
event
How to set up and validate locally
-
Install Snowplow micro
gdk config set snowplow_micro.enabled true gdk reconfigure
-
In rails console enable identity verification
Feature.enable(:identity_verification) Feature.enable(:identity_verification_phone_number) ApplicationSetting.first.update(require_admin_approval_after_user_signup: false) ApplicationSetting.first.update(send_user_confirmation_email: true)
-
Configure Telesign (the external service we use to send verification codes). The credentials can be found in 1Password.
ApplicationSetting.first.update(telesign_customer_xid: CUSTOMER_ID, telesign_api_key: API_KEY)
-
Sign up for a new account. After, you should be redirected to the Identity Verification page (
http://localhost:3000/users/identity_verification
) -
Enable phone verification for the user
user = User.last risk_band = user.custom_attributes.by_key('arkose_risk_band').first_or_initialize risk_band.update!(value: 'Medium')
-
Refresh the page, validate that phone number verification step is shown
-
Enter in your phone number and the verification code you receive.
-
Visit
http://localhost:9091/micro/good
to check that all events are tracked.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/issues/124