Skip to content
Merged
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: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}.git" }

ruby "~> #{File.read(File.join(__dir__, '.ruby-version')).strip}"

gem 'rails', '~> 7.0.0'
gem 'rails', '~> 7.1.0'

gem 'activerecord-postgis-adapter'
gem 'activerecord-postgis-adapter', '~> 9.0'
gem 'ahoy_matey', '~> 3.0'
gem 'aws-sdk-kms', '~> 1.4'
gem 'aws-sdk-cloudwatchlogs', require: false
Expand Down
175 changes: 97 additions & 78 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -60,73 +60,81 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (7.0.7.2)
actionpack (= 7.0.7.2)
activesupport (= 7.0.7.2)
actioncable (7.1.0)
actionpack (= 7.1.0)
activesupport (= 7.1.0)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.7.2)
actionpack (= 7.0.7.2)
activejob (= 7.0.7.2)
activerecord (= 7.0.7.2)
activestorage (= 7.0.7.2)
activesupport (= 7.0.7.2)
zeitwerk (~> 2.6)
actionmailbox (7.1.0)
actionpack (= 7.1.0)
activejob (= 7.1.0)
activerecord (= 7.1.0)
activestorage (= 7.1.0)
activesupport (= 7.1.0)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.7.2)
actionpack (= 7.0.7.2)
actionview (= 7.0.7.2)
activejob (= 7.0.7.2)
activesupport (= 7.0.7.2)
actionmailer (7.1.0)
actionpack (= 7.1.0)
actionview (= 7.1.0)
activejob (= 7.1.0)
activesupport (= 7.1.0)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.7.2)
actionview (= 7.0.7.2)
activesupport (= 7.0.7.2)
rack (~> 2.0, >= 2.2.4)
rails-dom-testing (~> 2.2)
actionpack (7.1.0)
actionview (= 7.1.0)
activesupport (= 7.1.0)
nokogiri (>= 1.8.5)
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.7.2)
actionpack (= 7.0.7.2)
activerecord (= 7.0.7.2)
activestorage (= 7.0.7.2)
activesupport (= 7.0.7.2)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.0)
actionpack (= 7.1.0)
activerecord (= 7.1.0)
activestorage (= 7.1.0)
activesupport (= 7.1.0)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.7.2)
activesupport (= 7.0.7.2)
actionview (7.1.0)
activesupport (= 7.1.0)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.7.2)
activesupport (= 7.0.7.2)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.1.0)
activesupport (= 7.1.0)
globalid (>= 0.3.6)
activemodel (7.0.7.2)
activesupport (= 7.0.7.2)
activerecord (7.0.7.2)
activemodel (= 7.0.7.2)
activesupport (= 7.0.7.2)
activerecord-postgis-adapter (8.0.2)
activerecord (~> 7.0.0)
activemodel (7.1.0)
activesupport (= 7.1.0)
activerecord (7.1.0)
activemodel (= 7.1.0)
activesupport (= 7.1.0)
timeout (>= 0.4.0)
activerecord-postgis-adapter (9.0.0)
activerecord (~> 7.1.0)
rgeo-activerecord (~> 7.0.0)
activestorage (7.0.7.2)
actionpack (= 7.0.7.2)
activejob (= 7.0.7.2)
activerecord (= 7.0.7.2)
activesupport (= 7.0.7.2)
activestorage (7.1.0)
actionpack (= 7.1.0)
activejob (= 7.1.0)
activerecord (= 7.1.0)
activesupport (= 7.1.0)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.7.2)
activesupport (7.1.0)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
Expand Down Expand Up @@ -185,6 +193,7 @@ GEM
thread_safe (~> 0.3, >= 0.3.1)
barby (0.6.8)
base32-crockford (0.1.0)
base64 (0.1.1)
bcrypt (3.1.16)
benchmark-ips (2.12.0)
better_errors (2.10.1)
Expand All @@ -198,13 +207,14 @@ GEM
erubi (~> 1.4)
parser (>= 2.4)
smart_properties
bigdecimal (3.1.4)
bindata (2.4.14)
bootsnap (1.16.0)
msgpack (~> 1.2)
brakeman (6.0.1)
browser (5.3.1)
builder (3.2.4)
bullet (7.0.7)
bullet (7.1.0)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
bundler-audit (0.9.1)
Expand All @@ -226,7 +236,7 @@ GEM
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
concurrent-ruby (1.2.2)
connection_pool (2.4.0)
connection_pool (2.4.1)
cose (1.3.0)
cbor (~> 0.5.9)
openssl-signature_algorithm (~> 1.0)
Expand Down Expand Up @@ -265,6 +275,8 @@ GEM
dotiw (5.3.2)
activesupport
i18n
drb (2.1.1)
ruby2_keywords
dumb_delegator (1.0.0)
email_spec (2.2.2)
htmlentities (~> 4.3.3)
Expand Down Expand Up @@ -307,8 +319,8 @@ GEM
geocoder (1.7.0)
get_process_mem (0.2.7)
ffi (~> 1.0)
globalid (1.1.0)
activesupport (>= 5.0)
globalid (1.2.1)
activesupport (>= 6.1)
good_job (3.12.3)
activejob (>= 6.0.0)
activerecord (>= 6.0.0)
Expand Down Expand Up @@ -408,11 +420,12 @@ GEM
mini_histogram (0.3.1)
mini_mime (1.1.5)
mini_portile2 (2.8.4)
minitest (5.19.0)
minitest (5.20.0)
msgpack (1.7.2)
multiset (0.5.3)
mutex_m (0.1.2)
nenv (0.3.0)
net-imap (0.3.7)
net-imap (0.4.0)
date
net-protocol
net-pop (0.1.2)
Expand All @@ -421,7 +434,7 @@ GEM
timeout
net-sftp (3.0.0)
net-ssh (>= 5.0.0, < 7.0.0)
net-smtp (0.3.3)
net-smtp (0.4.0)
net-protocol
net-ssh (6.1.0)
newrelic_rpm (9.5.0)
Expand Down Expand Up @@ -459,7 +472,7 @@ GEM
activesupport (>= 7.0.0)
rack
railties (>= 7.0.0)
pry (0.14.1)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.10.1)
Expand All @@ -486,26 +499,31 @@ GEM
rack (>= 1.2.0)
rack-proxy (0.7.4)
rack
rack-session (1.0.1)
rack (< 3)
rack-test (2.1.0)
rack (>= 1.3)
rack-timeout (0.6.0)
rack_session_access (0.2.0)
builder (>= 2.0.0)
rack (>= 1.0.0)
rails (7.0.7.2)
actioncable (= 7.0.7.2)
actionmailbox (= 7.0.7.2)
actionmailer (= 7.0.7.2)
actionpack (= 7.0.7.2)
actiontext (= 7.0.7.2)
actionview (= 7.0.7.2)
activejob (= 7.0.7.2)
activemodel (= 7.0.7.2)
activerecord (= 7.0.7.2)
activestorage (= 7.0.7.2)
activesupport (= 7.0.7.2)
rackup (1.0.0)
rack (< 3)
webrick
rails (7.1.0)
actioncable (= 7.1.0)
actionmailbox (= 7.1.0)
actionmailer (= 7.1.0)
actionpack (= 7.1.0)
actiontext (= 7.1.0)
actionview (= 7.1.0)
activejob (= 7.1.0)
activemodel (= 7.1.0)
activerecord (= 7.1.0)
activestorage (= 7.1.0)
activesupport (= 7.1.0)
bundler (>= 1.15.0)
railties (= 7.0.7.2)
railties (= 7.1.0)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -520,13 +538,14 @@ GEM
rails-i18n (7.0.6)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
railties (7.0.7.2)
actionpack (= 7.0.7.2)
activesupport (= 7.0.7.2)
method_source
railties (7.1.0)
actionpack (= 7.1.0)
activesupport (= 7.1.0)
irb
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.0.6)
rb-fsevent (0.11.2)
Expand Down Expand Up @@ -715,15 +734,15 @@ GEM
xpath (3.2.0)
nokogiri (~> 1.8)
yard (0.9.34)
zeitwerk (2.6.11)
zeitwerk (2.6.12)
zonebie (0.6.1)
zxcvbn (0.1.9)

PLATFORMS
ruby

DEPENDENCIES
activerecord-postgis-adapter
activerecord-postgis-adapter (~> 9.0)
ahoy_matey (~> 3.0)
aws-sdk-cloudwatchlogs
aws-sdk-kms (~> 1.4)
Expand Down Expand Up @@ -799,7 +818,7 @@ DEPENDENCIES
rack-test (>= 1.1.0)
rack-timeout
rack_session_access (>= 0.2.0)
rails (~> 7.0.0)
rails (~> 7.1.0)
rails-controller-testing (>= 1.0.4)
redacted_struct
redis (>= 3.2.0)
Expand Down Expand Up @@ -844,4 +863,4 @@ RUBY VERSION
ruby 3.2.2p53

BUNDLED WITH
2.4.4
2.4.20
21 changes: 9 additions & 12 deletions app/forms/otp_verification_form.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# frozen_string_literal: true

class OtpVerificationForm
include ActiveModel::Model

validates :code, presence: true
validate :validate_code_length
CODE_REGEX = /\A[0-9]+\z/
validates :code, presence: true, length: { is: TwoFactorAuthenticatable::DIRECT_OTP_LENGTH }
validate :validate_code_matches_format
validate :validate_user_otp_presence
validate :validate_user_otp_expiration
Expand Down Expand Up @@ -31,31 +33,26 @@ def submit

attr_reader :code, :user, :phone_configuration

def validate_code_length
return if code.blank? || code.size == TwoFactorAuthenticatable::DIRECT_OTP_LENGTH
errors.add(:code, :incorrect_length, type: :incorrect_length)
end

def validate_code_matches_format
return if code.blank? || code.match?(/^[0-9]+/i)
errors.add(:code, :pattern_mismatch, type: :pattern_mismatch)
return if code.blank? || code.match?(CODE_REGEX)
errors.add(:code, 'pattern_mismatch', type: :pattern_mismatch)
end

def validate_user_otp_presence
return if user.direct_otp.present?
errors.add(:code, :user_otp_missing, type: :user_otp_missing)
errors.add(:code, 'user_otp_missing', type: :user_otp_missing)
end

def validate_user_otp_expiration
return if !otp_expired?
errors.add(:code, :user_otp_expired, type: :user_otp_expired)
errors.add(:code, 'user_otp_expired', type: :user_otp_expired)
end

def validate_code_equals_user_otp
return if code.blank? ||
user.direct_otp.blank? ||
ActiveSupport::SecurityUtils.secure_compare(user.direct_otp, code)
errors.add(:code, :incorrect, type: :incorrect)
errors.add(:code, 'incorrect', type: :incorrect)
end

def otp_expired?
Expand Down
2 changes: 1 addition & 1 deletion app/forms/webauthn_verification_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def self.domain_name

def validate_assertion_response
return if webauthn_error.present? || webauthn_configuration.blank? || valid_assertion_response?
errors.add(:authenticator_data, :invalid_authenticator_data, type: :invalid_authenticator_data)
errors.add(:authenticator_data, 'invalid_authenticator_data', type: :invalid_authenticator_data)
end

def validate_webauthn_error
Expand Down
4 changes: 2 additions & 2 deletions app/jobs/risc_delivery_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ class RiscDeliveryJob < ApplicationJob

retry_on(
*NETWORK_ERRORS,
wait: :exponentially_longer,
wait: :polynomially_longer,
attempts: 2,
)
retry_on RedisRateLimiter::LimitError,
wait: :exponentially_longer,
wait: :polynomially_longer,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a change in behavior, just a rename to be more accurate: rails/rails#49292

attempts: 10

def self.warning_error_classes
Expand Down
Loading