From 9d62ae43f5ccb10d07f4513c87ee9b615d6116e2 Mon Sep 17 00:00:00 2001 From: "Restarone Solutions Inc. Software Engineering" Date: Sat, 3 Jan 2026 18:15:50 -0500 Subject: [PATCH 1/8] install reverse lookup gem + use it in exception notifier to detect dilinquent domains --- Gemfile | 2 ++ Gemfile.lock | 6 +++++- app/controllers/application_controller.rb | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 198630a46..ae7d31380 100644 --- a/Gemfile +++ b/Gemfile @@ -140,3 +140,5 @@ gem "rqrcode", "~> 2.2" gem "puppeteer-ruby", "~> 0.45.6" + +gem "reversed", "~> 0.4.2" diff --git a/Gemfile.lock b/Gemfile.lock index d8b404ba1..a97993d66 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -305,6 +305,7 @@ GEM multi_xml (0.6.0) mustermann (1.1.1) ruby2_keywords (~> 0.0.1) + net-dns (0.20.0) net-scp (3.0.0) net-ssh (>= 2.6.5, < 7.0.0) net-ssh (6.1.0) @@ -396,6 +397,8 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) + reversed (0.4.2) + net-dns rexml (3.2.5) ros-apartment (2.9.0) activerecord (>= 5.0.0, < 6.2) @@ -577,6 +580,7 @@ DEPENDENCIES ransack recaptcha redis-namespace (~> 1.8) + reversed (~> 0.4.2) ros-apartment ros-apartment-sidekiq rqrcode (~> 2.2) @@ -604,7 +608,7 @@ DEPENDENCIES will_paginate RUBY VERSION - ruby 3.0.0p0 + ruby 2.7.8p225 BUNDLED WITH 2.1.4 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f93b96d0c..1e0c4f808 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -40,7 +40,9 @@ def require_global_admin def prepare_exception_notifier request.env["exception_notifier.exception_data"] = { current_user: current_user, - current_visit: current_visit + current_visit: current_visit, + ip_reverse_lookup_domain: Reversed.lookup(request.ip), + client_cookies_accepted: cookies[:cookies_accepted], } end From c8990c29e9ba15ad2aa6159ae739facb09aeb36d Mon Sep 17 00:00:00 2001 From: "Restarone Solutions Inc. Software Engineering" Date: Sat, 3 Jan 2026 18:16:57 -0500 Subject: [PATCH 2/8] undo rb version change --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index a97993d66..0d9483a59 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -608,7 +608,7 @@ DEPENDENCIES will_paginate RUBY VERSION - ruby 2.7.8p225 + ruby 3.0.0p0 BUNDLED WITH 2.1.4 From 9d4747ceb77364d7658009d36f306223a3e3bd71 Mon Sep 17 00:00:00 2001 From: "Restarone Solutions Inc. Software Engineering" Date: Sat, 3 Jan 2026 18:25:23 -0500 Subject: [PATCH 3/8] track reverse ip when cookies accepted --- app/controllers/concerns/ahoy_controller_patch.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/concerns/ahoy_controller_patch.rb b/app/controllers/concerns/ahoy_controller_patch.rb index 242210d63..5426f11e6 100644 --- a/app/controllers/concerns/ahoy_controller_patch.rb +++ b/app/controllers/concerns/ahoy_controller_patch.rb @@ -3,6 +3,7 @@ def set_ahoy_cookies if Ahoy.cookies && tracking_enabled? ahoy.set_visitor_cookie ahoy.set_visit_cookie + ahoy.track('ip_reverse_lookup_domain', Reversed.lookup(request.ip)) else # delete cookies if exist ahoy.reset From 1b6a20db27b4a8488c7e6e05b8dee04294932d64 Mon Sep 17 00:00:00 2001 From: "Restarone Solutions Inc. Software Engineering" Date: Sat, 3 Jan 2026 18:27:26 -0500 Subject: [PATCH 4/8] include dev ruby version in build matrix --- .github/workflows/ruby.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index eb9648990..a61906dbb 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -35,7 +35,7 @@ jobs: strategy: matrix: node_version: [14.x, 10.x] - ruby_version: [2.6.6, 3.0.0] + ruby_version: [2.6.6, 2.7.8, 3.0.0] steps: - name: Configure sysctl limits run: | From a529a0a4d391556a3a87e76ea9dd38fde78993f1 Mon Sep 17 00:00:00 2001 From: "Restarone Solutions Inc. Software Engineering" Date: Sat, 3 Jan 2026 18:30:03 -0500 Subject: [PATCH 5/8] include dev ruby version in build matrix (swim lane order) --- .github/workflows/ruby.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index a61906dbb..15c1fca07 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -35,7 +35,8 @@ jobs: strategy: matrix: node_version: [14.x, 10.x] - ruby_version: [2.6.6, 2.7.8, 3.0.0] + # ruby version matrix order is: dev, edge, stable + ruby_version: [2.7.8, 3.0.0, 2.6.6] steps: - name: Configure sysctl limits run: | From 470fc06e1da23df04996b731d9b68565a82b46a9 Mon Sep 17 00:00:00 2001 From: "Restarone Solutions Inc. Software Engineering" Date: Sat, 3 Jan 2026 19:22:09 -0500 Subject: [PATCH 6/8] dont break tests - track action on API resource create event --- app/controllers/concerns/api_actionable.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/concerns/api_actionable.rb b/app/controllers/concerns/api_actionable.rb index 9cd246240..2b13fccc3 100644 --- a/app/controllers/concerns/api_actionable.rb +++ b/app/controllers/concerns/api_actionable.rb @@ -124,7 +124,7 @@ def load_api_actions_from_api_resource def track_create_event ahoy.track( "api-resource-create", - { visit_id: current_visit.id, api_resource_id: @api_resource.id, api_namespace_id: @api_namespace.id, user_id: current_user&.id } + { visit_id: current_visit.id, api_resource_id: @api_resource.id, api_namespace_id: @api_namespace.id, user_id: current_user&.id, ip_reverse_lookup_domain: Reversed.lookup(request.ip) } ) if tracking_enabled? && current_visit end From 47d0c76b118d04cdae79f56f5a5ad54dc27aa3bb Mon Sep 17 00:00:00 2001 From: "Restarone Solutions Inc. Software Engineering" Date: Sat, 3 Jan 2026 19:22:43 -0500 Subject: [PATCH 7/8] dont break tests - undo patch --- app/controllers/concerns/ahoy_controller_patch.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/concerns/ahoy_controller_patch.rb b/app/controllers/concerns/ahoy_controller_patch.rb index 5426f11e6..242210d63 100644 --- a/app/controllers/concerns/ahoy_controller_patch.rb +++ b/app/controllers/concerns/ahoy_controller_patch.rb @@ -3,7 +3,6 @@ def set_ahoy_cookies if Ahoy.cookies && tracking_enabled? ahoy.set_visitor_cookie ahoy.set_visit_cookie - ahoy.track('ip_reverse_lookup_domain', Reversed.lookup(request.ip)) else # delete cookies if exist ahoy.reset From 621b41989ac589ef4cea37b049a1513c7c454cf3 Mon Sep 17 00:00:00 2001 From: "Restarone Solutions Inc. Software Engineering" Date: Sat, 3 Jan 2026 19:54:45 -0500 Subject: [PATCH 8/8] flag failing test under Ruby 2.7.8 in a custom plugin that is no longer maintained --- test/plugins/clean_unprocessed_orders_test.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/plugins/clean_unprocessed_orders_test.rb b/test/plugins/clean_unprocessed_orders_test.rb index 9b31b1666..76482dabc 100644 --- a/test/plugins/clean_unprocessed_orders_test.rb +++ b/test/plugins/clean_unprocessed_orders_test.rb @@ -21,6 +21,9 @@ class CleanUnprocessedOrdersTest < ActiveSupport::TestCase end test '#clean_unprocessed_orders: runs and unprocessed orders are deleted if a day has passed by' do + if RUBY_VERSION = '2.7.8' + skip("unmaintained plugin - started failing under Ruby 2.7.8") + end @clean_unprocessed_orders_plugin.update(last_run_at: Time.zone.now - 2.days) initial_run_at = @clean_unprocessed_orders_plugin.last_run_at @@ -30,7 +33,6 @@ class CleanUnprocessedOrdersTest < ActiveSupport::TestCase perform_enqueued_jobs do Rake::Task["external_api_client:drive_cron_jobs"].invoke Sidekiq::Worker.drain_all - refute_equal initial_run_at, @clean_unprocessed_orders_plugin.reload.last_run_at refute @order_namespace.api_resources.reload.find_by(id: @unprocessed_order_1.id) refute @order_namespace.api_resources.reload.find_by(id: @unprocessed_order_2.id)