Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ Layout/MultilineHashBraceLayout:
Layout/MultilineMethodCallBraceLayout:
Enabled: true

Layout/MultilineMethodCallIndentation:
Enabled: true
EnforcedStyle: aligned

Layout/MultilineMethodDefinitionBraceLayout:
Enabled: true
EnforcedStyle: symmetrical
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/verify/document_capture_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def create

def enqueue_job
verify_document_capture_session = DocumentCaptureSession.
find_by(uuid: params[:document_capture_session_uuid])
find_by(uuid: params[:document_capture_session_uuid])
verify_document_capture_session.requested_at = Time.zone.now
verify_document_capture_session.create_doc_auth_session

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/concerns/saml_idp_logout_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def handle_valid_sp_logout_request
def handle_valid_sp_remote_logout_request(user_id)
# Remotely delete the user's current session
session_id = ServiceProviderIdentity.
find_by(user_id: user_id, service_provider: saml_request.issuer).
rails_session_id
find_by(user_id: user_id, service_provider: saml_request.issuer).
rails_session_id

OutOfBandSessionAccessor.new(session_id).destroy
sign_out if user_signed_in?
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def device_and_events
return if !device

@events = Event.where(user_id: user_id, device_id: device.id).order(created_at: :desc).
limit(EVENTS_PAGE_SIZE).
map(&:decorate)
limit(EVENTS_PAGE_SIZE).
map(&:decorate)
@device = device.decorate
end

Expand Down
2 changes: 1 addition & 1 deletion app/decorators/user_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def identity_events

def recent_devices
@recent_devices ||= user.devices.order(last_used_at: :desc).limit(MAX_RECENT_DEVICES).
map(&:decorate)
map(&:decorate)
end

def devices?
Expand Down
18 changes: 9 additions & 9 deletions app/forms/idv/api_image_upload_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,15 @@ def acuant_sdk_capture?

def image_metadata
@image_metadata ||= params.permit(:front_image_metadata, :back_image_metadata).
to_h.
transform_values do |str|
JSON.parse(str)
rescue JSON::ParserError
nil
end.
compact.
transform_keys { |key| key.gsub(/_image_metadata$/, '') }.
deep_symbolize_keys
to_h.
transform_values do |str|
JSON.parse(str)
rescue JSON::ParserError
nil
end.
compact.
transform_keys { |key| key.gsub(/_image_metadata$/, '') }.
deep_symbolize_keys
end

def add_costs(response)
Expand Down
2 changes: 1 addition & 1 deletion app/jobs/get_usps_proofing_results_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def perform(_now)
proofer = UspsInPersonProofing::Proofer.new

reprocess_delay_minutes = IdentityConfig.store.
get_usps_proofing_results_job_reprocess_delay_minutes
get_usps_proofing_results_job_reprocess_delay_minutes
InPersonEnrollment.needs_usps_status_check(
...reprocess_delay_minutes.minutes.ago,
).each do |enrollment|
Expand Down
10 changes: 5 additions & 5 deletions app/jobs/reports/combined_invoice_supplement_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ def combine_by_iaa_month(by_iaa_results:, by_issuer_results:)
end

by_issuer_iaa_issuer_year_months = by_issuer_results.
group_by { |r| r[:iaa] }.
transform_values do |iaa|
iaa.group_by { |r| r[:issuer] }.
transform_values { |issuer| issuer.group_by { |r| r[:year_month] } }
end
group_by { |r| r[:iaa] }.
transform_values do |iaa|
iaa.group_by { |r| r[:issuer] }.
transform_values { |issuer| issuer.group_by { |r| r[:year_month] } }
end

# rubocop:disable Metrics/BlockLength
CSV.generate do |csv|
Expand Down
8 changes: 4 additions & 4 deletions app/models/backup_code_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ def find_with_code(code:, user_id:)
code = RandomPhrase.normalize(code)

user_salt_costs = select(:code_salt, :code_cost).
distinct.
where(user_id: user_id).
where.not(code_salt: nil).where.not(code_cost: nil).
pluck(:code_salt, :code_cost)
distinct.
where(user_id: user_id).
where.not(code_salt: nil).where.not(code_cost: nil).
pluck(:code_salt, :code_cost)

salted_fingerprints = user_salt_costs.map do |salt, cost|
scrypt_password_digest(password: code, salt: salt, cost: cost)
Expand Down
10 changes: 5 additions & 5 deletions app/models/in_person_enrollment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ class InPersonEnrollment < ApplicationRecord
# Find enrollments that need a status check via the USPS API
def self.needs_usps_status_check(check_interval)
where(status: :pending).
and(
where(status_check_attempted_at: check_interval).
or(where(status_check_attempted_at: nil)),
).
order(status_check_attempted_at: :asc)
and(
where(status_check_attempted_at: check_interval).
or(where(status_check_attempted_at: nil)),
).
order(status_check_attempted_at: :asc)
end

# Does this enrollment need a status check via the USPS API?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def call(issuer:, iaa:, iaa_start_date:, iaa_end_date:)
iaa_range = (iaa_start_date..iaa_end_date)

full_months, partial_months = Reports::MonthHelper.months(iaa_range).
partition do |month_range|
Reports::MonthHelper.full_month?(month_range)
end
partition do |month_range|
Reports::MonthHelper.full_month?(month_range)
end

# The subqueries create a uniform representation of data:
# - full months from monthly_sp_auth_counts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ def call(key:, issuers:, start_date:, end_date:)
return [] if !date_range || issuers.blank?

full_months, partial_months = Reports::MonthHelper.months(date_range).
partition do |month_range|
Reports::MonthHelper.full_month?(month_range)
end
partition do |month_range|
Reports::MonthHelper.full_month?(month_range)
end

# The subqueries create a uniform representation of data:
# - full months from monthly_sp_auth_counts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def log_alerts(alerts)
alerts.keys.each do |key|
alerts[key.to_sym].each do |alert|
alert_name_key = alert[:name].
downcase.
parameterize(separator: '_').to_sym
downcase.
parameterize(separator: '_').to_sym
side = alert[:side] || 'no_side'

log_alert_results[alert_name_key] =
Expand Down
2 changes: 1 addition & 1 deletion app/services/proofing/aamva/proofer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def initialize(**attrs)
def aamva_proof(applicant, result)
aamva_applicant = Aamva::Applicant.from_proofer_applicant(OpenStruct.new(applicant))
response = Aamva::VerificationClient.new(config).
send_verification_request(applicant: aamva_applicant)
send_verification_request(applicant: aamva_applicant)
result.transaction_id = response.transaction_locator_id
unless response.success?
response.verification_results.each do |attribute, v_result|
Expand Down
16 changes: 8 additions & 8 deletions app/services/uuid_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ def all_issuers_belong_to_an_sp?

def all_issuers_belong_to_same_agency?
agency_count = Agency.
joins(:service_providers).
where(service_providers: { issuer: issuers }).
distinct.
count
joins(:service_providers).
where(service_providers: { issuer: issuers }).
distinct.
count

return if agency_count == 1

Expand Down Expand Up @@ -101,11 +101,11 @@ def collect_identities(agency, emails_to_user_ids)
# advantage of the composite indexes and are highly non-performant.
actual_user_ids = emails_to_user_ids.values.select(&:present?)
user_ids_with_identities = ServiceProviderIdentity.
where(user_id: actual_user_ids, service_provider: issuers).
pluck(:user_id)
where(user_id: actual_user_ids, service_provider: issuers).
pluck(:user_id)
agency_identities = AgencyIdentity.
select(:uuid, :user_id).
where(user_id: user_ids_with_identities, agency_id: agency.id)
select(:uuid, :user_id).
where(user_id: user_ids_with_identities, agency_id: agency.id)

uuid_hash = agency_identities.map { |record| [record.user_id, record.uuid] }.to_h
emails_to_user_ids.transform_values { |user_id| uuid_hash[user_id] }
Expand Down
2 changes: 1 addition & 1 deletion lib/analytics_events_documenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def analytics_methods
database.select do |_k, object|
# this check will fail if the namespace is nested more than once
method_object_name_parts = [object.namespace&.parent&.name, object.namespace&.name].
select { |part| part.present? && part != :root }
select { |part| part.present? && part != :root }

object.type == :method && method_object_name_parts == class_name_parts
end.values
Expand Down
2 changes: 1 addition & 1 deletion lib/identity_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,6 @@ def self.build_store(config_map)

@key_types = config.key_types
@store = RedactedStruct.new('IdentityConfig', *config.written_env.keys, keyword_init: true).
new(**config.written_env)
new(**config.written_env)
end
end
6 changes: 3 additions & 3 deletions lib/pinpoint_supported_countries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ def run
country_dialing_codes = load_country_dialing_codes

duplicate_iso = country_dialing_codes.
group_by(&:iso_code).
select { |iso, arr| arr.size > 1 }.
keys
group_by(&:iso_code).
select { |iso, arr| arr.size > 1 }.
keys

raise "error countries with duplicate iso codes: #{duplicate_iso}" if duplicate_iso.size > 0

Expand Down
22 changes: 11 additions & 11 deletions lib/query_tracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ def self.track
queries = Hash.new { |h, k| h[k] = [] }

subscriber = ActiveSupport::Notifications.
subscribe('sql.active_record') do |_name, _start, _finish, _id, payload|
sql = payload[:sql]
subscribe('sql.active_record') do |_name, _start, _finish, _id, payload|
sql = payload[:sql]

action = sql.split(' ').first.downcase.to_sym
tables = PgQuery.parse(sql).tables.map(&:to_sym)
action = sql.split(' ').first.downcase.to_sym
tables = PgQuery.parse(sql).tables.map(&:to_sym)

root = Rails.root.to_s
location = caller.find do |line|
line.include?(root) && Gem.path.none? { |v| line.include?(v) }
end
root = Rails.root.to_s
location = caller.find do |line|
line.include?(root) && Gem.path.none? { |v| line.include?(v) }
end

tables.each do |table|
queries[table] << [action, location]
end
tables.each do |table|
queries[table] << [action, location]
end
end

yield

Expand Down
4 changes: 2 additions & 2 deletions scripts/changelog_check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ def format_changelog(changelog_entries)
changelog = ''
CATEGORIES.each do |category|
category_changes = changelog_entries.
filter { |(changelog_category, _change), _changes| changelog_category == category }.
sort_by { |(_category, change), _changes| change }
filter { |(changelog_category, _change), _changes| changelog_category == category }.
sort_by { |(_category, change), _changes| change }

next if category_changes.empty?
changelog.concat("## #{category}\n")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def index; end

before do
allow(IdentityConfig.store).to receive(:proofing_device_profiling_collecting_enabled).
and_return(ff_enabled)
and_return(ff_enabled)
end

context 'ff is set' do
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/idv/gpo_verify_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
action

disavowal_event_count = user.events.where(event_type: :account_verified, ip: '0.0.0.0').
where.not(disavowal_token_fingerprint: nil).count
where.not(disavowal_token_fingerprint: nil).count
expect(disavowal_event_count).to eq 1
expect(response).to redirect_to(sign_up_completed_url)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/idv/review_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def show
it 'creates an `account_verified` event once per confirmation' do
put :create, params: { user: { password: ControllerHelper::VALID_PASSWORD } }
disavowal_event_count = user.events.where(event_type: :account_verified, ip: '0.0.0.0').
where.not(disavowal_token_fingerprint: nil).count
where.not(disavowal_token_fingerprint: nil).count
expect(disavowal_event_count).to eq 1
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
with(:mfa_verify_backup_code, success: false)

expect(@analytics).to receive(:track_event).
with('Multi-Factor Authentication: max attempts reached')
with('Multi-Factor Authentication: max attempts reached')
expect(PushNotification::HttpPush).to receive(:deliver).
with(PushNotification::MfaLimitAccountLockedEvent.new(user: subject.current_user))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
with(properties)

expect(@analytics).to receive(:track_event).
with('Multi-Factor Authentication: max attempts reached')
with('Multi-Factor Authentication: max attempts reached')
expect(PushNotification::HttpPush).to receive(:deliver).
with(PushNotification::MfaLimitAccountLockedEvent.new(user: subject.current_user))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
expect(@analytics).to receive(:track_mfa_submit_event).
with(properties)
expect(@analytics).to receive(:track_event).
with('Multi-Factor Authentication: max attempts reached')
with('Multi-Factor Authentication: max attempts reached')
expect(PushNotification::HttpPush).to receive(:deliver).
with(PushNotification::MfaLimitAccountLockedEvent.new(user: subject.current_user))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
)

expect(@analytics).to receive(:track_event).
with('Multi-Factor Authentication: max attempts reached')
with('Multi-Factor Authentication: max attempts reached')
expect(PushNotification::HttpPush).to receive(:deliver).
with(PushNotification::MfaLimitAccountLockedEvent.new(user: subject.current_user))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
expect(@analytics).to receive(:track_mfa_submit_event).
with(attributes)
expect(@analytics).to receive(:track_event).
with('Multi-Factor Authentication: max attempts reached')
with('Multi-Factor Authentication: max attempts reached')
expect(@irs_attempts_api_tracker).to receive(:track_event).
with(:mfa_verify_totp, success: false)
expect(PushNotification::HttpPush).to receive(:deliver).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@
let(:view_context) { ActionController::Base.new.view_context }
before do
allow_any_instance_of(TwoFactorAuthCode::WebauthnAuthenticationPresenter).
to receive(:multiple_factors_enabled?).
and_return(true)
to receive(:multiple_factors_enabled?).
and_return(true)
end

it 'redirects to webauthn show page' do
Expand All @@ -175,8 +175,8 @@
context 'User only has webauthn as an MFA method' do
before do
allow_any_instance_of(TwoFactorAuthCode::WebauthnAuthenticationPresenter).
to receive(:multiple_factors_enabled?).
and_return(false)
to receive(:multiple_factors_enabled?).
and_return(false)
end

it 'redirects to webauthn error page ' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
let(:enforcement_date) { Time.zone.today + 6.days }
before do
allow(IdentityConfig.store).to receive(:kantara_restriction_enforcement_date).
and_return(enforcement_date)
and_return(enforcement_date)
end

context 'before enforcement date' do
Expand All @@ -55,7 +55,7 @@

user.reload
expect(user.non_restricted_mfa_required_prompt_skip_date).
to eq Time.zone.today
to eq Time.zone.today
end

it 'does not allow unauthenticated users' do
Expand Down
Loading