Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy RC 194 to Prod #6464

Merged
merged 28 commits into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e1fcab6
LG-5938-document-analytics-19 (#6432)
gsa-manish Jun 1, 2022
518535d
LG-6499: Update missing GPO-specific content (IdV app) (#6429)
aduth Jun 2, 2022
377febe
Add step feature flag association to IdV API endpoints (#6435)
aduth Jun 2, 2022
cdea08f
LG-6043: first change over to new url (#6353)
mdiarra3 Jun 2, 2022
22e940c
Generate completion URL on password confirm submission (IdV app) (#6433)
aduth Jun 2, 2022
43d49f9
Fix missing reactivation prompt for password reset with prior cancell…
aduth Jun 2, 2022
3c13a51
Drop deprecated user columns (#6438)
mitchellhenke Jun 2, 2022
322a5c3
Fix paste for personal key confirmation (IdV app) (#6443)
aduth Jun 3, 2022
92e2fe7
Remove support for password confirm as first step of IdV app (#6434)
aduth Jun 3, 2022
d9907b4
Merge content-only JavaScript-enabled feature spec cases (#6449)
aduth Jun 3, 2022
92f1ba8
Fix flakey OTP lockout spec (#6445)
aduth Jun 3, 2022
935cabe
Use IdV mock PII data consistently (#6448)
aduth Jun 3, 2022
d9ae660
LG-5939 Document the rest of analytics events #20 (#6437)
stevegsa Jun 3, 2022
2fb6294
Scroll alert into view on password confirm error (IdV app) (#6450)
aduth Jun 3, 2022
d169fc7
Fix logging of webauthn authentications (#6451)
mitchellhenke Jun 3, 2022
fe11234
Try skipping screens in IdV feature spec helpers (#6447)
aduth Jun 3, 2022
175666f
Only show reset personal key if user has an active profile (#6452)
mitchellhenke Jun 3, 2022
c5c8fe6
Consolidate IdV cancellation feature specs (#6454)
aduth Jun 6, 2022
7c29e66
Remove references to database throttles (#6428)
mitchellhenke Jun 6, 2022
019d5c3
Remove duplicate IdV cancellation spec (#6458)
aduth Jun 6, 2022
26161f1
Enable Session Encryption v2 everywhere (#6455)
mitchellhenke Jun 6, 2022
6df2940
Only include "billable" events in billing reports (LG-6539) (#6459)
zachmargolis Jun 6, 2022
94731a9
Update config to add support for additional AAMVA DLDV states (#6444)
nprimak Jun 6, 2022
220d02a
LG-6330: Route IPP users to the idv phone flow (#6446)
Jun 6, 2022
5633218
changelog: Upcoming Feature, Authentication, update to not cancel, bu…
mdiarra3 Jun 7, 2022
66c3a5a
Include more context when logging telephony sent events (#6460)
mitchellhenke Jun 7, 2022
29dbf38
Bump identity-style-guide from 6.4.2 to 6.5.0 (#6461)
dependabot[bot] Jun 7, 2022
172391d
Revert AAMVA supported states (#6470)
aduth Jun 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/account_reset/request_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def create_account_reset_request
def confirm_two_factor_enabled
return if MfaPolicy.new(current_user).two_factor_enabled?

redirect_to two_factor_options_url
redirect_to authentication_methods_setup_url
end

def analytics_attributes
Expand Down
15 changes: 0 additions & 15 deletions app/controllers/api/base_controller.rb

This file was deleted.

26 changes: 26 additions & 0 deletions app/controllers/api/verify/base_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module Api
module Verify
class BaseController < ApplicationController
include RenderConditionConcern

class_attribute :required_step

check_or_render_not_found -> do
if self.class.required_step.blank?
raise NotImplementedError, 'Controller must define required_step'
end
IdentityConfig.store.idv_api_enabled_steps.include?(self.class.required_step)
end
before_action :confirm_two_factor_authenticated_for_api

respond_to :json

private

def confirm_two_factor_authenticated_for_api
return if user_fully_authenticated?
render json: { error: 'user is not fully authenticated' }, status: :unauthorized
end
end
end
end
21 changes: 17 additions & 4 deletions app/controllers/api/verify/password_confirm_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module Api
module Verify
class PasswordConfirmController < Api::BaseController
class PasswordConfirmController < BaseController
self.required_step = 'password_confirm'

def create
result, personal_key = Api::ProfileCreationForm.new(
password: verify_params[:password],
Expand All @@ -12,9 +14,10 @@ def create
if result.success?
user = User.find_by(uuid: result.extra[:user_uuid])
add_proofing_component(user)
render json: { personal_key: personal_key,
profile_pending: result.extra[:profile_pending] },
status: :ok
render json: {
personal_key: personal_key,
completion_url: completion_url(result),
}
else
render json: { error: result.errors }, status: :bad_request
end
Expand All @@ -29,6 +32,16 @@ def verify_params
def add_proofing_component(user)
ProofingComponent.create_or_find_by(user: user).update(verified_at: Time.zone.now)
end

def completion_url(result)
if result.extra[:profile_pending]
idv_come_back_later_url
elsif current_sp
sign_up_completed_url
else
account_url
end
end
end
end
end
4 changes: 3 additions & 1 deletion app/controllers/api/verify/password_reset_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module Api
module Verify
class PasswordResetController < Api::BaseController
class PasswordResetController < BaseController
self.required_step = 'password_confirm'

def create
analytics.idv_forgot_password_confirmed
request_id = sp_session[:request_id]
Expand Down
5 changes: 3 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ def add_piv_cac_setup_url
end

def service_provider_mfa_setup_url
service_provider_mfa_policy.user_needs_sp_auth_method_setup? ? two_factor_options_url : nil
service_provider_mfa_policy.user_needs_sp_auth_method_setup? ?
authentication_methods_setup_url : nil
end

def fix_broken_personal_key_url
Expand Down Expand Up @@ -312,7 +313,7 @@ def prompt_to_sign_in_with_request_id(request_id)
end

def prompt_to_setup_mfa
redirect_to two_factor_options_url
redirect_to authentication_methods_setup_url
end

def prompt_to_verify_mfa
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/concerns/render_condition_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module RenderConditionConcern

module ClassMethods
def check_or_render_not_found(callable, **kwargs)
before_action(**kwargs) { render_not_found if !callable.call }
before_action(**kwargs) { render_not_found if !instance_exec(&callable) }
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ def authenticate_user
end

def handle_second_factor_locked_user(type)
analytics.track_event(Analytics::MULTI_FACTOR_AUTH_MAX_ATTEMPTS)
analytics.multi_factor_auth_max_attempts
event = PushNotification::MfaLimitAccountLockedEvent.new(user: current_user)
PushNotification::HttpPush.deliver(event)
handle_max_attempts(type + '_login_attempts')
end

def handle_too_many_otp_sends
analytics.track_event(Analytics::MULTI_FACTOR_AUTH_MAX_SENDS)
analytics.multi_factor_auth_max_sends
handle_max_attempts('otp_requests')
end

Expand Down
11 changes: 1 addition & 10 deletions app/controllers/idv/review_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,7 @@ def need_personal_key_confirmation?
end

def next_step
if idv_api_personal_key_step_enabled?
idv_app_url
else
idv_personal_key_url
end
end

def idv_api_personal_key_step_enabled?
return false if idv_session.address_verification_mechanism == 'gpo'
IdentityConfig.store.idv_api_enabled_steps.include?('personal_key')
idv_personal_key_url
end
end
end
4 changes: 1 addition & 3 deletions app/controllers/openid_connect/authorization_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ def track_authorize_analytics(result)
analytics_attributes = result.to_h.except(:redirect_uri).
merge(user_fully_authenticated: user_fully_authenticated?)

analytics.track_event(
Analytics::OPENID_CONNECT_REQUEST_AUTHORIZATION, analytics_attributes
)
analytics.openid_connect_request_authorization(**analytics_attributes)
end

def identity_needs_verification?
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/openid_connect/token_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def create
@token_form = OpenidConnectTokenForm.new(token_params)

result = @token_form.submit
analytics.track_event(Analytics::OPENID_CONNECT_TOKEN, result.to_h)
analytics.openid_connect_token(**result.to_h)

render json: @token_form.response,
status: (result.success? ? :ok : :bad_request)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/openid_connect/user_info_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def show
def authenticate_identity_via_bearer_token
verifier = AccessTokenVerifier.new(request.env['HTTP_AUTHORIZATION'])
response = verifier.submit
analytics.track_event(Analytics::OPENID_CONNECT_BEARER_TOKEN, response.to_h)
analytics.openid_connect_bearer_token(**response.to_h)

if response.success?
@current_identity = verifier.identity
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/sign_up/passwords_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def process_unsuccessful_password_creation

def sign_in_and_redirect_user
sign_in @user
redirect_to two_factor_options_url
redirect_to authentication_methods_setup_url
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ class OptionsController < ApplicationController
def index
@two_factor_options_form = TwoFactorLoginOptionsForm.new(current_user)
@presenter = two_factor_options_presenter
analytics.track_event(Analytics::MULTI_FACTOR_AUTH_OPTION_LIST_VISIT)
analytics.multi_factor_auth_option_list_visit
end

def create
@two_factor_options_form = TwoFactorLoginOptionsForm.new(current_user)
result = @two_factor_options_form.submit(two_factor_options_form_params)
analytics.track_event(Analytics::MULTI_FACTOR_AUTH_OPTION_LIST, result.to_h)
analytics.multi_factor_auth_option_list(**result.to_h)

if result.success?
process_valid_form
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ def form_params

def post_analytics(result)
properties = result.to_h.merge(analytics_properties)
if context == 'confirmation'
analytics.track_event(Analytics::MULTI_FACTOR_AUTH_SETUP, properties)
end
analytics.multi_factor_auth_setup(**properties) if context == 'confirmation'

analytics.track_mfa_submit_event(properties)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def create
def check_personal_key_enabled
return if TwoFactorAuthentication::PersonalKeyPolicy.new(current_user).enabled?

redirect_to two_factor_options_url
redirect_to authentication_methods_setup_url
end

def presenter_for_two_factor_authentication_method
Expand Down Expand Up @@ -97,7 +97,7 @@ def handle_valid_otp
elsif MfaPolicy.new(current_user).two_factor_enabled?
redirect_to after_mfa_setup_path
else
redirect_to two_factor_options_url
redirect_to authentication_methods_setup_url
end
reset_otp_session_data
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def load_phone

def other_options_mfa_url
if new_user?
two_factor_options_path
authentication_methods_setup_path
elsif has_other_auth_methods? && !user_fully_authenticated?
login_two_factor_options_path
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ def credential_ids
end

def analytics_properties
auth_method = if form&.webauthn_configuration&.platform_authenticator || params[:platform]
auth_method = if form&.webauthn_configuration&.platform_authenticator ||
params[:platform].to_s == 'true'
'webauthn_platform'
else
'webauthn'
Expand Down
1 change: 1 addition & 0 deletions app/controllers/users/mfa_selection_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class MfaSelectionController < ApplicationController

def index
@two_factor_options_form = TwoFactorOptionsForm.new(current_user)
@after_setup_path = after_mfa_setup_path
@presenter = two_factor_options_presenter
analytics.user_registration_2fa_additional_setup_visit
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/users/phone_setup_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def index
def create
@new_phone_form = NewPhoneForm.new(current_user)
result = @new_phone_form.submit(new_phone_form_params)
analytics.track_event(Analytics::MULTI_FACTOR_AUTH_PHONE_SETUP, result.to_h)
analytics.multi_factor_auth_phone_setup(**result.to_h)

if result.success?
handle_create_success(@new_phone_form.phone)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def piv_cac_service_url_with_redirect

def process_piv_cac_setup
result = user_piv_cac_form.submit
analytics.track_event(Analytics::MULTI_FACTOR_AUTH_SETUP, result.to_h)
analytics.multi_factor_auth_setup(**result.to_h)
if result.success?
process_valid_submission
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def render_prompt

def process_piv_cac_setup
result = user_piv_cac_form.submit
analytics.track_event(Analytics::MULTI_FACTOR_AUTH_SETUP, result.to_h)
analytics.multi_factor_auth_setup(**result.to_h)
if result.success?
process_valid_submission
else
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/users/totp_setup_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def new
def confirm
result = totp_setup_form.submit

analytics.track_event(Analytics::MULTI_FACTOR_AUTH_SETUP, result.to_h)
analytics.multi_factor_auth_setup(**result.to_h)

if result.success?
process_valid_code
Expand Down
23 changes: 16 additions & 7 deletions app/controllers/users/two_factor_authentication_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def show

def send_code
result = otp_delivery_selection_form.submit(delivery_params)
analytics.track_event(Analytics::OTP_DELIVERY_SELECTION, result.to_h)
analytics.otp_delivery_selection(**result.to_h)
if result.success?
handle_valid_otp_params(user_select_delivery_preference, user_selected_default_number)
update_otp_delivery_preference_if_needed
Expand Down Expand Up @@ -54,7 +54,7 @@ def redirect_on_nothing_enabled
if MfaPolicy.new(current_user).two_factor_enabled?
redirect_to login_two_factor_options_path
else
redirect_to two_factor_options_url
redirect_to authentication_methods_setup_url
end
end

Expand All @@ -68,7 +68,7 @@ def phone_configuration

def validate_otp_delivery_preference_and_send_code
result = otp_delivery_selection_form.submit(otp_delivery_preference: delivery_preference)
analytics.track_event(Analytics::OTP_DELIVERY_SELECTION, result.to_h)
analytics.otp_delivery_selection(**result.to_h)
phone_is_confirmed = UserSessionContext.authentication_context?(context)
phone_capabilities = PhoneNumberCapabilities.new(
parsed_phone,
Expand Down Expand Up @@ -180,7 +180,7 @@ def handle_valid_otp_params(method, default = nil)
end

def handle_telephony_result(method:, default:)
track_events
track_events(otp_delivery_preference: method)
if @telephony_result.success?
redirect_to login_two_factor_url(
otp_delivery_preference: method,
Expand All @@ -197,8 +197,17 @@ def handle_telephony_result(method:, default:)
end
end

def track_events
analytics.track_event(Analytics::TELEPHONY_OTP_SENT, @telephony_result.to_h)
def track_events(otp_delivery_preference:)
analytics.telephony_otp_sent(
area_code: parsed_phone.area_code,
country_code: parsed_phone.country_code,
phone_fingerprint: Pii::Fingerprinter.fingerprint(parsed_phone.e164),
context: context,
otp_delivery_preference: otp_delivery_preference,
resend: params.dig(:otp_delivery_selection_form, :resend),
telephony_response: @telephony_result.to_h,
success: @telephony_result.success?,
)
end

def exceeded_otp_send_limit?
Expand Down Expand Up @@ -308,7 +317,7 @@ def handle_too_many_confirmation_sends
if user_fully_authenticated?
redirect_to account_url
else
redirect_to two_factor_options_url
redirect_to authentication_methods_setup_url
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ def create
elsif (result.errors[:selection].include? 'phone') ||
IdentityConfig.store.kantara_2fa_phone_restricted
flash[:phone_error] = t('errors.two_factor_auth_setup.must_select_additional_option')
redirect_to two_factor_options_path(anchor: 'select_phone')
redirect_to authentication_methods_setup_path(anchor: 'select_phone')
else
@presenter = two_factor_options_presenter
render :index
end
rescue ActionController::ParameterMissing
flash[:error] = t('errors.two_factor_auth_setup.must_select_option')
redirect_back(fallback_location: two_factor_options_path, allow_other_host: false)
redirect_back(fallback_location: authentication_methods_setup_path, allow_other_host: false)
end

private
Expand Down
Loading