From 4d879b5fa47d2da61bf4c2dc8fcc2781c005b3fb Mon Sep 17 00:00:00 2001 From: Nat Budin Date: Mon, 28 Oct 2024 12:53:15 -0700 Subject: [PATCH 1/8] Update Ruby, remove some obsolete stuff --- .ruby-version | 2 +- Gemfile | 8 ----- Gemfile.lock | 36 +-------------------- lib/cassy/utils.rb | 7 +---- lib/crypt-isaac.rb | 2 -- lib/tasks/ae_users_import.rake | 57 ---------------------------------- 6 files changed, 3 insertions(+), 109 deletions(-) delete mode 100644 lib/crypt-isaac.rb delete mode 100644 lib/tasks/ae_users_import.rake diff --git a/.ruby-version b/.ruby-version index ef538c2..fa7adc7 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.1.2 +3.3.5 diff --git a/Gemfile b/Gemfile index 5cb868c..94ece89 100644 --- a/Gemfile +++ b/Gemfile @@ -26,7 +26,6 @@ gem "coffee-rails" gem "jquery-rails" -gem "crypt-isaac" # for Cassy gem "doorkeeper", "5.6.6" gem "will_paginate" @@ -36,16 +35,9 @@ gem "pg_search" # gem 'foreman' gem "puma" -gem "ae_users_migrator" gem "figaro" -gem "capistrano", "~> 3.0", require: false, group: :development - group :development do - gem "capistrano-rails", "~> 1.1", require: false - gem "capistrano-bundler", "~> 2.1", require: false - gem "capistrano-rbenv", "~> 2.0", require: false - gem "capistrano-maintenance", "~> 1.0", require: false gem "listen" gem "ed25519" gem "bcrypt_pbkdf" diff --git a/Gemfile.lock b/Gemfile.lock index ae15751..67852f1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -68,10 +68,6 @@ GEM tzinfo (~> 2.0) addressable (2.8.1) public_suffix (>= 2.0.2, < 6.0) - ae_users_migrator (1.0.6) - activerecord (>= 2.3) - airbrussh (1.4.1) - sshkit (>= 1.6.1, != 1.7.0) ansi (1.5.0) autoprefixer-rails (10.4.7.0) execjs (~> 2) @@ -118,21 +114,6 @@ GEM sassc (>= 2.0.0) builder (3.2.4) cancancan (3.4.0) - capistrano (3.17.1) - airbrussh (>= 1.0.0) - i18n - rake (>= 10.0.0) - sshkit (>= 1.9.0) - capistrano-bundler (2.1.0) - capistrano (~> 3.1) - capistrano-maintenance (1.2.1) - capistrano (>= 3.0) - capistrano-rails (1.6.2) - capistrano (~> 3.1) - capistrano-bundler (>= 1.1, < 3) - capistrano-rbenv (2.2.0) - capistrano (~> 3.1) - sshkit (~> 1.3) capybara (3.38.0) addressable matrix @@ -154,7 +135,6 @@ GEM crack (0.4.5) rexml crass (1.0.6) - crypt-isaac (1.2.0) database_cleaner (2.0.1) database_cleaner-active_record (~> 2.0.0) database_cleaner-active_record (2.0.1) @@ -236,11 +216,7 @@ GEM net-protocol net-protocol (0.2.2) timeout - net-scp (4.0.0) - net-ssh (>= 2.6.5, < 8.0.0) net-smtp (0.4.0.1) - net-protocol - net-ssh (7.0.1) nio4r (2.7.3) nokogiri (1.16.5) mini_portile2 (~> 2.8.2) @@ -327,9 +303,6 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - sshkit (1.21.3) - net-scp (>= 1.1.2) - net-ssh (>= 2.8.0) temple (0.9.1) thor (1.3.1) tilt (2.0.11) @@ -363,21 +336,14 @@ PLATFORMS ruby DEPENDENCIES - ae_users_migrator autoprefixer-rails aws-sdk-rails bcrypt_pbkdf bootsnap (>= 1.1.0) bootstrap-sass (~> 3.4.1) cancancan - capistrano (~> 3.0) - capistrano-bundler (~> 2.1) - capistrano-maintenance (~> 1.0) - capistrano-rails (~> 1.1) - capistrano-rbenv (~> 2.0) capybara coffee-rails - crypt-isaac database_cleaner devise (~> 4.8.1) devise-encryptable @@ -412,7 +378,7 @@ DEPENDENCIES will_paginate-bootstrap RUBY VERSION - ruby 3.1.2p20 + ruby 3.3.5p100 BUNDLED WITH 2.3.17 diff --git a/lib/cassy/utils.rb b/lib/cassy/utils.rb index 6848c7c..d5dba91 100644 --- a/lib/cassy/utils.rb +++ b/lib/cassy/utils.rb @@ -4,12 +4,7 @@ module Cassy module Utils def random_string(max_length = 29) - rg = Crypt::ISAAC.new - max = 4294619050 - r = "#{Time.now.to_i}r%X%X%X%X%X%X%X%X" % - [rg.rand(max), rg.rand(max), rg.rand(max), rg.rand(max), - rg.rand(max), rg.rand(max), rg.rand(max), rg.rand(max)] - r[0..max_length-1] + SecureRandom.alphanumeric(max_length) end module_function :random_string diff --git a/lib/crypt-isaac.rb b/lib/crypt-isaac.rb deleted file mode 100644 index 655f230..0000000 --- a/lib/crypt-isaac.rb +++ /dev/null @@ -1,2 +0,0 @@ -# Workaround for cassy requiring crypt-isaac -require 'crypt/isaac' diff --git a/lib/tasks/ae_users_import.rake b/lib/tasks/ae_users_import.rake deleted file mode 100644 index 35bb5bb..0000000 --- a/lib/tasks/ae_users_import.rake +++ /dev/null @@ -1,57 +0,0 @@ -namespace :ae_users do - task :import => :environment do - require 'ae_users_migrator/import' - - dumpfile = AeUsersMigrator::Import::Dumpfile.load(File.new('ae_users.json')) - dumpfile.people.each do |person_id, ae_person| - email = ae_person.primary_email_address.try(:address) - unless email - puts "Not importing person #{ae_person} - no email address" - next - end - - Person.transaction do - illyan_person = Person.where(:email => email).includes([:groups]).first - illyan_person ||= Person.new(:email => email) - - if illyan_person.last_sign_in_at - puts "Skipping already imported person #{email}" - else - if ae_person.account.nil? - puts "Skipping person #{email} because they have no account info" - next - end - - # we should overwrite this person since they've never signed into Illyan - %w{firstname lastname gender birthdate}.each do |f| - illyan_person.send("#{f}=", ae_person.send(f)) - end - - ae_person.roles.each do |role| - next if illyan_person.groups.any? { |g| g.name == role.name } - group = Group.find_or_create_by_name(role.name) - illyan_person.groups << group - end - - if illyan_person.encrypted_password.blank? && illyan_person.legacy_password_sha1.blank? - puts "Setting legacy password for #{email}" - illyan_person.legacy_password_md5 = ae_person.account.password - end - - if ae_person.account.try(:active) && !illyan_person.confirmed? - illyan_person.skip_confirmation! - puts "Confirmed person #{email}" - else - illyan_person.skip_confirmation_notification! - end - - if illyan_person.save - puts "Imported person #{email}" - else - puts "Couldn't import person #{email}: #{illyan_person.errors.full_messages.join(", ")}" - end - end - end - end - end -end \ No newline at end of file From d1329540765595ea791f27846b2a0bc523a44e8f Mon Sep 17 00:00:00 2001 From: Nat Budin Date: Mon, 28 Oct 2024 12:53:35 -0700 Subject: [PATCH 2/8] Don't break if DATABASE_URL is unset --- config/database.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/database.yml b/config/database.yml index c52338f..ff53c89 100644 --- a/config/database.yml +++ b/config/database.yml @@ -14,4 +14,4 @@ test: &test database: illyan_test production: - url: <%= ENV.fetch('DATABASE_URL') %> + url: <%= ENV['DATABASE_URL'] %> From 2546b9780bae0a5079fbe79955a69e4f82f74f24 Mon Sep 17 00:00:00 2001 From: Nat Budin Date: Mon, 28 Oct 2024 12:55:47 -0700 Subject: [PATCH 3/8] Rails 7.1 --- Gemfile | 3 +- Gemfile.lock | 197 +++++++----- bin/setup | 2 +- config/application.rb | 5 + .../initializers/content_security_policy.rb | 4 +- .../initializers/filter_parameter_logging.rb | 6 +- .../new_framework_defaults_7_1.rb | 280 ++++++++++++++++++ config/initializers/permissions_policy.rb | 20 +- ..._to_active_storage_blobs.active_storage.rb | 22 ++ ..._storage_variant_records.active_storage.rb | 27 ++ ...e_storage_blobs_checksum.active_storage.rb | 8 + db/schema.rb | 61 ++-- 12 files changed, 505 insertions(+), 130 deletions(-) create mode 100644 config/initializers/new_framework_defaults_7_1.rb create mode 100644 db/migrate/20241028195500_add_service_name_to_active_storage_blobs.active_storage.rb create mode 100644 db/migrate/20241028195501_create_active_storage_variant_records.active_storage.rb create mode 100644 db/migrate/20241028195502_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb diff --git a/Gemfile b/Gemfile index 94ece89..3db5d6a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "http://rubygems.org" ruby File.read(File.expand_path("../.ruby-version", __FILE__)).strip -gem "rails", "7.0.8.1" +gem "rails", "7.1.4" # Reduces boot times through caching; required in config/boot.rb gem "bootsnap", ">= 1.1.0", require: false @@ -33,7 +33,6 @@ gem "will_paginate-bootstrap" gem "pg" gem "pg_search" -# gem 'foreman' gem "puma" gem "figaro" diff --git a/Gemfile.lock b/Gemfile.lock index 67852f1..68f27dc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,70 +1,79 @@ GEM remote: http://rubygems.org/ specs: - actioncable (7.0.8.1) - actionpack (= 7.0.8.1) - activesupport (= 7.0.8.1) + actioncable (7.1.4) + actionpack (= 7.1.4) + activesupport (= 7.1.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.8.1) - actionpack (= 7.0.8.1) - activejob (= 7.0.8.1) - activerecord (= 7.0.8.1) - activestorage (= 7.0.8.1) - activesupport (= 7.0.8.1) + zeitwerk (~> 2.6) + actionmailbox (7.1.4) + actionpack (= 7.1.4) + activejob (= 7.1.4) + activerecord (= 7.1.4) + activestorage (= 7.1.4) + activesupport (= 7.1.4) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.8.1) - actionpack (= 7.0.8.1) - actionview (= 7.0.8.1) - activejob (= 7.0.8.1) - activesupport (= 7.0.8.1) + actionmailer (7.1.4) + actionpack (= 7.1.4) + actionview (= 7.1.4) + activejob (= 7.1.4) + activesupport (= 7.1.4) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp - rails-dom-testing (~> 2.0) - actionpack (7.0.8.1) - actionview (= 7.0.8.1) - activesupport (= 7.0.8.1) - rack (~> 2.0, >= 2.2.4) + rails-dom-testing (~> 2.2) + actionpack (7.1.4) + actionview (= 7.1.4) + activesupport (= 7.1.4) + nokogiri (>= 1.8.5) + racc + 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.8.1) - actionpack (= 7.0.8.1) - activerecord (= 7.0.8.1) - activestorage (= 7.0.8.1) - activesupport (= 7.0.8.1) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + actiontext (7.1.4) + actionpack (= 7.1.4) + activerecord (= 7.1.4) + activestorage (= 7.1.4) + activesupport (= 7.1.4) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.8.1) - activesupport (= 7.0.8.1) + actionview (7.1.4) + activesupport (= 7.1.4) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.8.1) - activesupport (= 7.0.8.1) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.1.4) + activesupport (= 7.1.4) globalid (>= 0.3.6) - activemodel (7.0.8.1) - activesupport (= 7.0.8.1) - activerecord (7.0.8.1) - activemodel (= 7.0.8.1) - activesupport (= 7.0.8.1) - activestorage (7.0.8.1) - actionpack (= 7.0.8.1) - activejob (= 7.0.8.1) - activerecord (= 7.0.8.1) - activesupport (= 7.0.8.1) + activemodel (7.1.4) + activesupport (= 7.1.4) + activerecord (7.1.4) + activemodel (= 7.1.4) + activesupport (= 7.1.4) + timeout (>= 0.4.0) + activestorage (7.1.4) + actionpack (= 7.1.4) + activejob (= 7.1.4) + activerecord (= 7.1.4) + activesupport (= 7.1.4) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (7.0.8.1) + activesupport (7.1.4) + 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.1) public_suffix (>= 2.0.2, < 6.0) @@ -105,14 +114,16 @@ GEM rack (~> 2) aws-sigv4 (1.6.0) aws-eventstream (~> 1, >= 1.0.2) + base64 (0.2.0) bcrypt (3.1.20) bcrypt_pbkdf (1.1.0) + bigdecimal (3.1.8) bootsnap (1.15.0) msgpack (~> 1.2) bootstrap-sass (3.4.1) autoprefixer-rails (>= 5.2.1) sassc (>= 2.0.0) - builder (3.2.4) + builder (3.3.0) cancancan (3.4.0) capybara (3.38.0) addressable @@ -131,7 +142,8 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.2.3) + concurrent-ruby (1.3.4) + connection_pool (2.4.1) crack (0.4.5) rexml crass (1.0.6) @@ -155,9 +167,10 @@ GEM devise (>= 4.6) doorkeeper (5.6.6) railties (>= 5) + drb (2.2.1) dynamic_form (1.1.4) ed25519 (1.3.0) - erubi (1.12.0) + erubi (1.13.0) execjs (2.8.1) factory_bot (6.2.1) activesupport (>= 5.0.0) @@ -174,8 +187,12 @@ GEM thor tilt hashdiff (1.0.1) - i18n (1.14.1) + i18n (1.14.6) concurrent-ruby (~> 1.0) + io-console (0.7.2) + irb (1.14.1) + rdoc (>= 4.0.0) + reline (>= 0.4.2) jmespath (1.6.2) jquery-rails (4.5.1) rails-dom-testing (>= 1, < 3) @@ -186,7 +203,7 @@ GEM listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.22.0) + loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -194,12 +211,12 @@ GEM net-imap net-pop net-smtp - marcel (1.0.2) + marcel (1.0.4) matrix (0.4.2) - method_source (1.0.0) + method_source (1.1.0) mini_mime (1.1.5) - mini_portile2 (2.8.6) - minitest (5.22.0) + mini_portile2 (2.8.7) + minitest (5.25.1) minitest-reporters (1.6.1) ansi builder @@ -209,16 +226,18 @@ GEM minitest (>= 5.0) railties (>= 4.1) msgpack (1.6.0) - net-imap (0.4.10) + mutex_m (0.2.0) + net-imap (0.5.0) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.4.0.1) + net-smtp (0.5.0) + net-protocol nio4r (2.7.3) - nokogiri (1.16.5) + nokogiri (1.16.7) mini_portile2 (~> 2.8.2) racc (~> 1.4) orm_adapter (0.5.0) @@ -231,27 +250,34 @@ GEM method_source (~> 1.0) pry-rails (0.3.9) pry (>= 0.10.4) + psych (5.1.2) + stringio public_suffix (5.0.1) puma (6.4.3) nio4r (~> 2.0) - racc (1.7.3) - rack (2.2.8.1) + racc (1.8.1) + rack (2.2.10) + rack-session (1.0.2) + rack (< 3) rack-test (2.1.0) rack (>= 1.3) - rails (7.0.8.1) - actioncable (= 7.0.8.1) - actionmailbox (= 7.0.8.1) - actionmailer (= 7.0.8.1) - actionpack (= 7.0.8.1) - actiontext (= 7.0.8.1) - actionview (= 7.0.8.1) - activejob (= 7.0.8.1) - activemodel (= 7.0.8.1) - activerecord (= 7.0.8.1) - activestorage (= 7.0.8.1) - activesupport (= 7.0.8.1) + rackup (1.0.1) + rack (< 3) + webrick + rails (7.1.4) + actioncable (= 7.1.4) + actionmailbox (= 7.1.4) + actionmailer (= 7.1.4) + actionpack (= 7.1.4) + actiontext (= 7.1.4) + actionview (= 7.1.4) + activejob (= 7.1.4) + activemodel (= 7.1.4) + activerecord (= 7.1.4) + activestorage (= 7.1.4) + activesupport (= 7.1.4) bundler (>= 1.15.0) - railties (= 7.0.8.1) + railties (= 7.1.4) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -263,18 +289,23 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.0.8.1) - actionpack (= 7.0.8.1) - activesupport (= 7.0.8.1) - method_source + railties (7.1.4) + actionpack (= 7.1.4) + activesupport (= 7.1.4) + irb + rackup (>= 1.0.0) rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.5) - rake (13.1.0) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) + rake (13.2.1) rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) + rdoc (6.7.0) + psych (>= 4.0.0) regexp_parser (2.6.1) + reline (0.5.10) + io-console (~> 0.5) responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) @@ -303,8 +334,9 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) + stringio (3.1.1) temple (0.9.1) - thor (1.3.1) + thor (1.3.2) tilt (2.0.11) timeout (0.4.1) tzinfo (2.0.6) @@ -321,6 +353,7 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.8.2) websocket (1.2.9) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) @@ -330,7 +363,7 @@ GEM will_paginate (>= 3.0.3) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.13) + zeitwerk (2.7.1) PLATFORMS ruby @@ -364,7 +397,7 @@ DEPENDENCIES pg_search pry-rails puma - rails (= 7.0.8.1) + rails (= 7.1.4) rails-controller-testing rollbar sass-rails diff --git a/bin/setup b/bin/setup index ec47b79..3cd5a9d 100755 --- a/bin/setup +++ b/bin/setup @@ -5,7 +5,7 @@ require "fileutils" APP_ROOT = File.expand_path("..", __dir__) def system!(*args) - system(*args) || abort("\n== Command #{args} failed ==") + system(*args, exception: true) end FileUtils.chdir APP_ROOT do diff --git a/config/application.rb b/config/application.rb index a25bc44..2dceca7 100644 --- a/config/application.rb +++ b/config/application.rb @@ -11,6 +11,11 @@ class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 7.0 + # Please, add to the `ignore` list any other `lib` subdirectories that do + # not contain `.rb` files, or that should not be reloaded or eager loaded. + # Common ones are `templates`, `generators`, or `middleware`, for example. + config.autoload_lib(ignore: %w(assets tasks)) + # Configuration for the application, engines, and railties goes here. # # These settings can be overridden in specific environments using the files diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 54f47cf..b3076b3 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -16,9 +16,9 @@ # # policy.report_uri "/csp-violation-report-endpoint" # end # -# # Generate session nonces for permitted importmap and inline scripts +# # Generate session nonces for permitted importmap, inline scripts, and inline styles. # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } -# config.content_security_policy_nonce_directives = %w(script-src) +# config.content_security_policy_nonce_directives = %w(script-src style-src) # # # Report violations without enforcing the policy. # # config.content_security_policy_report_only = true diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index adc6568..c2d89e2 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,8 +1,8 @@ # Be sure to restart your server when you modify this file. -# Configure parameters to be filtered from the log file. Use this to limit dissemination of -# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported -# notations and behaviors. +# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file. +# Use this to limit dissemination of sensitive information. +# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors. Rails.application.config.filter_parameters += [ :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn ] diff --git a/config/initializers/new_framework_defaults_7_1.rb b/config/initializers/new_framework_defaults_7_1.rb new file mode 100644 index 0000000..3dc295d --- /dev/null +++ b/config/initializers/new_framework_defaults_7_1.rb @@ -0,0 +1,280 @@ +# Be sure to restart your server when you modify this file. +# +# This file eases your Rails 7.1 framework defaults upgrade. +# +# Uncomment each configuration one by one to switch to the new default. +# Once your application is ready to run with all new defaults, you can remove +# this file and set the `config.load_defaults` to `7.1`. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. +# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html + +### +# No longer add autoloaded paths into `$LOAD_PATH`. This means that you won't be able +# to manually require files that are managed by the autoloader, which you shouldn't do anyway. +# +# This will reduce the size of the load path, making `require` faster if you don't use bootsnap, or reduce the size +# of the bootsnap cache if you use it. +# +# To set this configuration, add the following line to `config/application.rb` (NOT this file): +# config.add_autoload_paths_to_load_path = false + +### +# Remove the default X-Download-Options headers since it is used only by Internet Explorer. +# If you need to support Internet Explorer, add back `"X-Download-Options" => "noopen"`. +#++ +# Rails.application.config.action_dispatch.default_headers = { +# "X-Frame-Options" => "SAMEORIGIN", +# "X-XSS-Protection" => "0", +# "X-Content-Type-Options" => "nosniff", +# "X-Permitted-Cross-Domain-Policies" => "none", +# "Referrer-Policy" => "strict-origin-when-cross-origin" +# } + +### +# Do not treat an `ActionController::Parameters` instance +# as equal to an equivalent `Hash` by default. +#++ +# Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality = false + +### +# Active Record Encryption now uses SHA-256 as its hash digest algorithm. +# +# There are 3 scenarios to consider. +# +# 1. If you have data encrypted with previous Rails versions, and you have +# +config.active_support.key_generator_hash_digest_class+ configured as SHA1 (the default +# before Rails 7.0), you need to configure SHA-1 for Active Record Encryption too: +#++ +# Rails.application.config.active_record.encryption.hash_digest_class = OpenSSL::Digest::SHA1 +# +# 2. If you have +config.active_support.key_generator_hash_digest_class+ configured as SHA256 (the new default +# in 7.0), then you need to configure SHA-256 for Active Record Encryption: +#++ +# Rails.application.config.active_record.encryption.hash_digest_class = OpenSSL::Digest::SHA256 +# +# 3. If you don't currently have data encrypted with Active Record encryption, you can disable this setting to +# configure the default behavior starting 7.1+: +#++ +# Rails.application.config.active_record.encryption.support_sha1_for_non_deterministic_encryption = false + +### +# No longer run after_commit callbacks on the first of multiple Active Record +# instances to save changes to the same database row within a transaction. +# Instead, run these callbacks on the instance most likely to have internal +# state which matches what was committed to the database, typically the last +# instance to save. +#++ +# Rails.application.config.active_record.run_commit_callbacks_on_first_saved_instances_in_transaction = false + +### +# Configures SQLite with a strict strings mode, which disables double-quoted string literals. +# +# SQLite has some quirks around double-quoted string literals. +# It first tries to consider double-quoted strings as identifier names, but if they don't exist +# it then considers them as string literals. Because of this, typos can silently go unnoticed. +# For example, it is possible to create an index for a non existing column. +# See https://www.sqlite.org/quirks.html#double_quoted_string_literals_are_accepted for more details. +#++ +# Rails.application.config.active_record.sqlite3_adapter_strict_strings_by_default = true + +### +# Disable deprecated singular associations names. +#++ +# Rails.application.config.active_record.allow_deprecated_singular_associations_name = false + +### +# Enable the Active Job `BigDecimal` argument serializer, which guarantees +# roundtripping. Without this serializer, some queue adapters may serialize +# `BigDecimal` arguments as simple (non-roundtrippable) strings. +# +# When deploying an application with multiple replicas, old (pre-Rails 7.1) +# replicas will not be able to deserialize `BigDecimal` arguments from this +# serializer. Therefore, this setting should only be enabled after all replicas +# have been successfully upgraded to Rails 7.1. +#++ +# Rails.application.config.active_job.use_big_decimal_serializer = true + +### +# Specify if an `ArgumentError` should be raised if `Rails.cache` `fetch` or +# `write` are given an invalid `expires_at` or `expires_in` time. +# Options are `true`, and `false`. If `false`, the exception will be reported +# as `handled` and logged instead. +#++ +# Rails.application.config.active_support.raise_on_invalid_cache_expiration_time = true + +### +# Specify whether Query Logs will format tags using the SQLCommenter format +# (https://open-telemetry.github.io/opentelemetry-sqlcommenter/), or using the legacy format. +# Options are `:legacy` and `:sqlcommenter`. +#++ +# Rails.application.config.active_record.query_log_tags_format = :sqlcommenter + +### +# Specify the default serializer used by `MessageEncryptor` and `MessageVerifier` +# instances. +# +# The legacy default is `:marshal`, which is a potential vector for +# deserialization attacks in cases where a message signing secret has been +# leaked. +# +# In Rails 7.1, the new default is `:json_allow_marshal` which serializes and +# deserializes with `ActiveSupport::JSON`, but can fall back to deserializing +# with `Marshal` so that legacy messages can still be read. +# +# In Rails 7.2, the default will become `:json` which serializes and +# deserializes with `ActiveSupport::JSON` only. +# +# Alternatively, you can choose `:message_pack` or `:message_pack_allow_marshal`, +# which serialize with `ActiveSupport::MessagePack`. `ActiveSupport::MessagePack` +# can roundtrip some Ruby types that are not supported by JSON, and may provide +# improved performance, but it requires the `msgpack` gem. +# +# For more information, see +# https://guides.rubyonrails.org/v7.1/configuring.html#config-active-support-message-serializer +# +# If you are performing a rolling deploy of a Rails 7.1 upgrade, wherein servers +# that have not yet been upgraded must be able to read messages from upgraded +# servers, first deploy without changing the serializer, then set the serializer +# in a subsequent deploy. +#++ +# Rails.application.config.active_support.message_serializer = :json_allow_marshal + +### +# Enable a performance optimization that serializes message data and metadata +# together. This changes the message format, so messages serialized this way +# cannot be read by older versions of Rails. However, messages that use the old +# format can still be read, regardless of whether this optimization is enabled. +# +# To perform a rolling deploy of a Rails 7.1 upgrade, wherein servers that have +# not yet been upgraded must be able to read messages from upgraded servers, +# leave this optimization off on the first deploy, then enable it on a +# subsequent deploy. +#++ +# Rails.application.config.active_support.use_message_serializer_for_metadata = true + +### +# Set the maximum size for Rails log files. +# +# `config.load_defaults 7.1` does not set this value for environments other than +# development and test. +#++ +# if Rails.env.local? +# Rails.application.config.log_file_size = 100 * 1024 * 1024 +# end + +### +# Enable raising on assignment to attr_readonly attributes. The previous +# behavior would allow assignment but silently not persist changes to the +# database. +#++ +# Rails.application.config.active_record.raise_on_assign_to_attr_readonly = true + +### +# Enable validating only parent-related columns for presence when the parent is mandatory. +# The previous behavior was to validate the presence of the parent record, which performed an extra query +# to get the parent every time the child record was updated, even when parent has not changed. +#++ +# Rails.application.config.active_record.belongs_to_required_validates_foreign_key = false + +### +# Enable precompilation of `config.filter_parameters`. Precompilation can +# improve filtering performance, depending on the quantity and types of filters. +#++ +# Rails.application.config.precompile_filter_parameters = true + +### +# Enable before_committed! callbacks on all enrolled records in a transaction. +# The previous behavior was to only run the callbacks on the first copy of a record +# if there were multiple copies of the same record enrolled in the transaction. +#++ +# Rails.application.config.active_record.before_committed_on_all_records = true + +### +# Disable automatic column serialization into YAML. +# To keep the historic behavior, you can set it to `YAML`, however it is +# recommended to explicitly define the serialization method for each column +# rather than to rely on a global default. +#++ +# Rails.application.config.active_record.default_column_serializer = nil + +### +# Enable a performance optimization that serializes Active Record models +# in a faster and more compact way. +# +# To perform a rolling deploy of a Rails 7.1 upgrade, wherein servers that have +# not yet been upgraded must be able to read caches from upgraded servers, +# leave this optimization off on the first deploy, then enable it on a +# subsequent deploy. +#++ +# Rails.application.config.active_record.marshalling_format_version = 7.1 + +### +# Run `after_commit` and `after_*_commit` callbacks in the order they are defined in a model. +# This matches the behaviour of all other callbacks. +# In previous versions of Rails, they ran in the inverse order. +#++ +# Rails.application.config.active_record.run_after_transaction_callbacks_in_order_defined = true + +### +# Whether a `transaction` block is committed or rolled back when exited via `return`, `break` or `throw`. +#++ +# Rails.application.config.active_record.commit_transaction_on_non_local_return = true + +### +# Controls when to generate a value for has_secure_token declarations. +#++ +# Rails.application.config.active_record.generate_secure_token_on = :initialize + +### +# ** Please read carefully, this must be configured in config/application.rb ** +# +# Change the format of the cache entry. +# +# Changing this default means that all new cache entries added to the cache +# will have a different format that is not supported by Rails 7.0 +# applications. +# +# Only change this value after your application is fully deployed to Rails 7.1 +# and you have no plans to rollback. +# When you're ready to change format, add this to `config/application.rb` (NOT +# this file): +# config.active_support.cache_format_version = 7.1 + +### +# Configure Action View to use HTML5 standards-compliant sanitizers when they are supported on your +# platform. +# +# `Rails::HTML::Sanitizer.best_supported_vendor` will cause Action View to use HTML5-compliant +# sanitizers if they are supported, else fall back to HTML4 sanitizers. +# +# In previous versions of Rails, Action View always used `Rails::HTML4::Sanitizer` as its vendor. +#++ +# Rails.application.config.action_view.sanitizer_vendor = Rails::HTML::Sanitizer.best_supported_vendor + +### +# Configure Action Text to use an HTML5 standards-compliant sanitizer when it is supported on your +# platform. +# +# `Rails::HTML::Sanitizer.best_supported_vendor` will cause Action Text to use HTML5-compliant +# sanitizers if they are supported, else fall back to HTML4 sanitizers. +# +# In previous versions of Rails, Action Text always used `Rails::HTML4::Sanitizer` as its vendor. +#++ +# Rails.application.config.action_text.sanitizer_vendor = Rails::HTML::Sanitizer.best_supported_vendor + +### +# Configure the log level used by the DebugExceptions middleware when logging +# uncaught exceptions during requests. +#++ +# Rails.application.config.action_dispatch.debug_exception_log_level = :error + +### +# Configure the test helpers in Action View, Action Dispatch, and rails-dom-testing to use HTML5 +# parsers. +# +# Nokogiri::HTML5 isn't supported on JRuby, so JRuby applications must set this to :html4. +# +# In previous versions of Rails, these test helpers always used an HTML4 parser. +#++ +# Rails.application.config.dom_testing_default_html_version = :html5 diff --git a/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb index 00f64d7..7db3b95 100644 --- a/config/initializers/permissions_policy.rb +++ b/config/initializers/permissions_policy.rb @@ -1,11 +1,13 @@ +# Be sure to restart your server when you modify this file. + # Define an application-wide HTTP permissions policy. For further -# information see https://developers.google.com/web/updates/2018/06/feature-policy -# -# Rails.application.config.permissions_policy do |f| -# f.camera :none -# f.gyroscope :none -# f.microphone :none -# f.usb :none -# f.fullscreen :self -# f.payment :self, "https://secure.example.com" +# information see: https://developers.google.com/web/updates/2018/06/feature-policy + +# Rails.application.config.permissions_policy do |policy| +# policy.camera :none +# policy.gyroscope :none +# policy.microphone :none +# policy.usb :none +# policy.fullscreen :self +# policy.payment :self, "https://secure.example.com" # end diff --git a/db/migrate/20241028195500_add_service_name_to_active_storage_blobs.active_storage.rb b/db/migrate/20241028195500_add_service_name_to_active_storage_blobs.active_storage.rb new file mode 100644 index 0000000..a15c6ce --- /dev/null +++ b/db/migrate/20241028195500_add_service_name_to_active_storage_blobs.active_storage.rb @@ -0,0 +1,22 @@ +# This migration comes from active_storage (originally 20190112182829) +class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0] + def up + return unless table_exists?(:active_storage_blobs) + + unless column_exists?(:active_storage_blobs, :service_name) + add_column :active_storage_blobs, :service_name, :string + + if configured_service = ActiveStorage::Blob.service.name + ActiveStorage::Blob.unscoped.update_all(service_name: configured_service) + end + + change_column :active_storage_blobs, :service_name, :string, null: false + end + end + + def down + return unless table_exists?(:active_storage_blobs) + + remove_column :active_storage_blobs, :service_name + end +end diff --git a/db/migrate/20241028195501_create_active_storage_variant_records.active_storage.rb b/db/migrate/20241028195501_create_active_storage_variant_records.active_storage.rb new file mode 100644 index 0000000..94ac83a --- /dev/null +++ b/db/migrate/20241028195501_create_active_storage_variant_records.active_storage.rb @@ -0,0 +1,27 @@ +# This migration comes from active_storage (originally 20191206030411) +class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0] + def change + return unless table_exists?(:active_storage_blobs) + + # Use Active Record's configured type for primary key + create_table :active_storage_variant_records, id: primary_key_type, if_not_exists: true do |t| + t.belongs_to :blob, null: false, index: false, type: blobs_primary_key_type + t.string :variation_digest, null: false + + t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true + t.foreign_key :active_storage_blobs, column: :blob_id + end + end + + private + def primary_key_type + config = Rails.configuration.generators + config.options[config.orm][:primary_key_type] || :primary_key + end + + def blobs_primary_key_type + pkey_name = connection.primary_key(:active_storage_blobs) + pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name } + pkey_column.bigint? ? :bigint : pkey_column.type + end +end diff --git a/db/migrate/20241028195502_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb b/db/migrate/20241028195502_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb new file mode 100644 index 0000000..93c8b85 --- /dev/null +++ b/db/migrate/20241028195502_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb @@ -0,0 +1,8 @@ +# This migration comes from active_storage (originally 20211119233751) +class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0] + def change + return unless table_exists?(:active_storage_blobs) + + change_column_null(:active_storage_blobs, :checksum, true) + end +end diff --git a/db/schema.rb b/db/schema.rb index e82c361..8d62735 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,8 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[6.1].define(version: 2022_07_06_154107) do - +ActiveRecord::Schema[7.1].define(version: 2024_10_28_195502) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" enable_extension "unaccent" @@ -19,8 +18,8 @@ create_table "casserver_lt", id: :serial, force: :cascade do |t| t.string "ticket", limit: 255, null: false t.string "client_hostname", limit: 255, null: false - t.datetime "consumed" - t.datetime "created_on", null: false + t.datetime "consumed", precision: nil + t.datetime "created_on", precision: nil, null: false end create_table "casserver_pgt", id: :serial, force: :cascade do |t| @@ -28,7 +27,7 @@ t.string "ticket", limit: 255, null: false t.string "client_hostname", limit: 255, null: false t.string "iou", limit: 255, null: false - t.datetime "created_on", null: false + t.datetime "created_on", precision: nil, null: false end create_table "casserver_st", id: :serial, force: :cascade do |t| @@ -39,15 +38,15 @@ t.text "service", null: false t.string "username", limit: 255, null: false t.string "type", limit: 255, null: false - t.datetime "consumed" - t.datetime "created_on", null: false + t.datetime "consumed", precision: nil + t.datetime "created_on", precision: nil, null: false end create_table "casserver_tgt", id: :serial, force: :cascade do |t| t.string "ticket", limit: 255, null: false t.string "client_hostname", limit: 255, null: false t.string "username", limit: 255, null: false - t.datetime "created_on", null: false + t.datetime "created_on", precision: nil, null: false t.text "extra_attributes", null: false end @@ -71,8 +70,8 @@ t.string "token", null: false t.integer "expires_in", null: false t.text "redirect_uri", null: false - t.datetime "created_at", null: false - t.datetime "revoked_at" + t.datetime "created_at", precision: nil, null: false + t.datetime "revoked_at", precision: nil t.string "scopes" t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true end @@ -83,8 +82,8 @@ t.string "token", null: false t.string "refresh_token" t.integer "expires_in" - t.datetime "revoked_at" - t.datetime "created_at", null: false + t.datetime "revoked_at", precision: nil + t.datetime "created_at", precision: nil, null: false t.string "scopes" t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id" @@ -98,8 +97,8 @@ t.text "redirect_uri", null: false t.string "scopes", default: "", null: false t.boolean "confidential", default: true, null: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true end @@ -107,34 +106,34 @@ t.string "firstname", limit: 255 t.string "lastname", limit: 255 t.string "gender", limit: 255 - t.datetime "birthdate" + t.datetime "birthdate", precision: nil t.string "email", limit: 255, default: "", null: false t.string "legacy_password_sha1", limit: 128, default: "", null: false t.string "legacy_password_sha1_salt", limit: 255, default: "", null: false t.string "remember_token", limit: 255 - t.datetime "remember_created_at" + t.datetime "remember_created_at", precision: nil t.string "confirmation_token", limit: 255 - t.datetime "confirmed_at" - t.datetime "confirmation_sent_at" + t.datetime "confirmed_at", precision: nil + t.datetime "confirmation_sent_at", precision: nil t.string "reset_password_token", limit: 255 t.integer "sign_in_count", default: 0 - t.datetime "current_sign_in_at" - t.datetime "last_sign_in_at" + t.datetime "current_sign_in_at", precision: nil + t.datetime "last_sign_in_at", precision: nil t.string "current_sign_in_ip", limit: 255 t.string "last_sign_in_ip", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.boolean "admin" t.string "legacy_password_md5", limit: 255 t.string "invitation_token", limit: 255 - t.datetime "invitation_sent_at" + t.datetime "invitation_sent_at", precision: nil t.integer "invitation_limit" t.integer "invited_by_id" t.string "invited_by_type", limit: 255 - t.datetime "invitation_accepted_at" + t.datetime "invitation_accepted_at", precision: nil t.string "encrypted_password", limit: 255, default: "", null: false - t.datetime "reset_password_sent_at" - t.datetime "invitation_created_at" + t.datetime "reset_password_sent_at", precision: nil + t.datetime "invitation_created_at", precision: nil t.index ["email"], name: "index_people_on_email" t.index ["invitation_token"], name: "index_people_on_invitation_token", unique: true end @@ -143,8 +142,8 @@ t.string "name", limit: 255 t.string "logo_url", limit: 255 t.text "description" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.boolean "public" t.string "authentication_token", limit: 255 t.string "urls", limit: 255, array: true @@ -162,10 +161,10 @@ create_table "ticket_granting_cookies", id: :serial, force: :cascade do |t| t.string "value", limit: 255, null: false t.string "username", limit: 255, null: false - t.datetime "consumed_at" + t.datetime "consumed_at", precision: nil t.text "extra_attributes" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil end add_foreign_key "services", "oauth_applications" From 5f25a84d5e9adc34173e8b063bfc6e95b30c28a5 Mon Sep 17 00:00:00 2001 From: Nat Budin Date: Mon, 28 Oct 2024 12:58:03 -0700 Subject: [PATCH 4/8] Rails 7.2 and Devise 5.9 --- Gemfile | 4 +- Gemfile.lock | 138 +++++++++--------- bin/setup | 6 +- config/application.rb | 2 +- config/initializers/assets.rb | 2 +- .../initializers/filter_parameter_logging.rb | 2 +- .../new_framework_defaults_7_2.rb | 70 +++++++++ config/puma.rb | 61 ++++---- db/schema.rb | 2 +- public/404.html | 69 +++++++-- public/406-unsupported-browser.html | 66 +++++++++ public/422.html | 69 +++++++-- public/500.html | 68 +++++++-- public/icon.png | Bin 0 -> 5599 bytes public/icon.svg | 3 + public/robots.txt | 6 +- 16 files changed, 409 insertions(+), 159 deletions(-) create mode 100644 config/initializers/new_framework_defaults_7_2.rb create mode 100644 public/406-unsupported-browser.html create mode 100644 public/icon.png create mode 100644 public/icon.svg diff --git a/Gemfile b/Gemfile index 3db5d6a..00341a9 100644 --- a/Gemfile +++ b/Gemfile @@ -1,13 +1,13 @@ source "http://rubygems.org" ruby File.read(File.expand_path("../.ruby-version", __FILE__)).strip -gem "rails", "7.1.4" +gem "rails", "7.2.1.2" # Reduces boot times through caching; required in config/boot.rb gem "bootsnap", ">= 1.1.0", require: false gem "aws-sdk-rails" -gem "devise", "~> 4.8.1" +gem "devise", "~> 4.9" gem "devise_invitable", "~> 2.0.9" gem "devise-encryptable" gem "cancancan" diff --git a/Gemfile.lock b/Gemfile.lock index 68f27dc..4ae6ee0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,80 +1,76 @@ GEM remote: http://rubygems.org/ specs: - actioncable (7.1.4) - actionpack (= 7.1.4) - activesupport (= 7.1.4) + actioncable (7.2.1.2) + actionpack (= 7.2.1.2) + activesupport (= 7.2.1.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.4) - actionpack (= 7.1.4) - activejob (= 7.1.4) - activerecord (= 7.1.4) - activestorage (= 7.1.4) - activesupport (= 7.1.4) - mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.1.4) - actionpack (= 7.1.4) - actionview (= 7.1.4) - activejob (= 7.1.4) - activesupport (= 7.1.4) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp + actionmailbox (7.2.1.2) + actionpack (= 7.2.1.2) + activejob (= 7.2.1.2) + activerecord (= 7.2.1.2) + activestorage (= 7.2.1.2) + activesupport (= 7.2.1.2) + mail (>= 2.8.0) + actionmailer (7.2.1.2) + actionpack (= 7.2.1.2) + actionview (= 7.2.1.2) + activejob (= 7.2.1.2) + activesupport (= 7.2.1.2) + mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.1.4) - actionview (= 7.1.4) - activesupport (= 7.1.4) + actionpack (7.2.1.2) + actionview (= 7.2.1.2) + activesupport (= 7.2.1.2) nokogiri (>= 1.8.5) racc - rack (>= 2.2.4) + rack (>= 2.2.4, < 3.2) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.4) - actionpack (= 7.1.4) - activerecord (= 7.1.4) - activestorage (= 7.1.4) - activesupport (= 7.1.4) + useragent (~> 0.16) + actiontext (7.2.1.2) + actionpack (= 7.2.1.2) + activerecord (= 7.2.1.2) + activestorage (= 7.2.1.2) + activesupport (= 7.2.1.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.4) - activesupport (= 7.1.4) + actionview (7.2.1.2) + activesupport (= 7.2.1.2) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.1.4) - activesupport (= 7.1.4) + activejob (7.2.1.2) + activesupport (= 7.2.1.2) globalid (>= 0.3.6) - activemodel (7.1.4) - activesupport (= 7.1.4) - activerecord (7.1.4) - activemodel (= 7.1.4) - activesupport (= 7.1.4) + activemodel (7.2.1.2) + activesupport (= 7.2.1.2) + activerecord (7.2.1.2) + activemodel (= 7.2.1.2) + activesupport (= 7.2.1.2) timeout (>= 0.4.0) - activestorage (7.1.4) - actionpack (= 7.1.4) - activejob (= 7.1.4) - activerecord (= 7.1.4) - activesupport (= 7.1.4) + activestorage (7.2.1.2) + actionpack (= 7.2.1.2) + activejob (= 7.2.1.2) + activerecord (= 7.2.1.2) + activesupport (= 7.2.1.2) marcel (~> 1.0) - activesupport (7.1.4) + activesupport (7.2.1.2) base64 bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) + concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - mutex_m - tzinfo (~> 2.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) addressable (2.8.1) public_suffix (>= 2.0.2, < 6.0) ansi (1.5.0) @@ -154,7 +150,7 @@ GEM database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) date (3.3.4) - devise (4.8.1) + devise (4.9.4) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) @@ -203,6 +199,7 @@ GEM listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) + logger (1.6.1) loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -226,7 +223,6 @@ GEM minitest (>= 5.0) railties (>= 4.1) msgpack (1.6.0) - mutex_m (0.2.0) net-imap (0.5.0) date net-protocol @@ -264,20 +260,20 @@ GEM rackup (1.0.1) rack (< 3) webrick - rails (7.1.4) - actioncable (= 7.1.4) - actionmailbox (= 7.1.4) - actionmailer (= 7.1.4) - actionpack (= 7.1.4) - actiontext (= 7.1.4) - actionview (= 7.1.4) - activejob (= 7.1.4) - activemodel (= 7.1.4) - activerecord (= 7.1.4) - activestorage (= 7.1.4) - activesupport (= 7.1.4) + rails (7.2.1.2) + actioncable (= 7.2.1.2) + actionmailbox (= 7.2.1.2) + actionmailer (= 7.2.1.2) + actionpack (= 7.2.1.2) + actiontext (= 7.2.1.2) + actionview (= 7.2.1.2) + activejob (= 7.2.1.2) + activemodel (= 7.2.1.2) + activerecord (= 7.2.1.2) + activestorage (= 7.2.1.2) + activesupport (= 7.2.1.2) bundler (>= 1.15.0) - railties (= 7.1.4) + railties (= 7.2.1.2) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -289,10 +285,10 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.1.4) - actionpack (= 7.1.4) - activesupport (= 7.1.4) - irb + railties (7.2.1.2) + actionpack (= 7.2.1.2) + activesupport (= 7.2.1.2) + irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) @@ -323,6 +319,7 @@ GEM sprockets (> 3.0) sprockets-rails tilt + securerandom (0.3.1) selenium-webdriver (4.7.1) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) @@ -343,6 +340,7 @@ GEM concurrent-ruby (~> 1.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) + useragent (0.16.10) warden (1.2.9) rack (>= 2.0.9) webdrivers (5.2.0) @@ -378,7 +376,7 @@ DEPENDENCIES capybara coffee-rails database_cleaner - devise (~> 4.8.1) + devise (~> 4.9) devise-encryptable devise_invitable (~> 2.0.9) doorkeeper (= 5.6.6) @@ -397,7 +395,7 @@ DEPENDENCIES pg_search pry-rails puma - rails (= 7.1.4) + rails (= 7.2.1.2) rails-controller-testing rollbar sass-rails diff --git a/bin/setup b/bin/setup index 3cd5a9d..472f01d 100755 --- a/bin/setup +++ b/bin/setup @@ -1,8 +1,8 @@ #!/usr/bin/env ruby require "fileutils" -# path to your application root. APP_ROOT = File.expand_path("..", __dir__) +APP_NAME = "illyan" def system!(*args) system(*args, exception: true) @@ -30,4 +30,8 @@ FileUtils.chdir APP_ROOT do puts "\n== Restarting application server ==" system! "bin/rails restart" + + # puts "\n== Configuring puma-dev ==" + # system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}" + # system "curl -Is https://#{APP_NAME}.test/up | head -n 1" end diff --git a/config/application.rb b/config/application.rb index 2dceca7..bee5d25 100644 --- a/config/application.rb +++ b/config/application.rb @@ -14,7 +14,7 @@ class Application < Rails::Application # Please, add to the `ignore` list any other `lib` subdirectories that do # not contain `.rb` files, or that should not be reloaded or eager loaded. # Common ones are `templates`, `generators`, or `middleware`, for example. - config.autoload_lib(ignore: %w(assets tasks)) + config.autoload_lib(ignore: %w[assets tasks]) # Configuration for the application, engines, and railties goes here. # diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 2eeef96..bd5bcd2 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -9,4 +9,4 @@ # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in the app/assets # folder are already added. -# Rails.application.config.assets.precompile += %w( admin.js admin.css ) +# Rails.application.config.assets.precompile += %w[ admin.js admin.css ] diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index c2d89e2..c010b83 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -4,5 +4,5 @@ # Use this to limit dissemination of sensitive information. # See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors. Rails.application.config.filter_parameters += [ - :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn + :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn ] diff --git a/config/initializers/new_framework_defaults_7_2.rb b/config/initializers/new_framework_defaults_7_2.rb new file mode 100644 index 0000000..b549c4a --- /dev/null +++ b/config/initializers/new_framework_defaults_7_2.rb @@ -0,0 +1,70 @@ +# Be sure to restart your server when you modify this file. +# +# This file eases your Rails 7.2 framework defaults upgrade. +# +# Uncomment each configuration one by one to switch to the new default. +# Once your application is ready to run with all new defaults, you can remove +# this file and set the `config.load_defaults` to `7.2`. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. +# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html + +### +# Controls whether Active Job's `#perform_later` and similar methods automatically defer +# the job queuing to after the current Active Record transaction is committed. +# +# Example: +# Topic.transaction do +# topic = Topic.create(...) +# NewTopicNotificationJob.perform_later(topic) +# end +# +# In this example, if the configuration is set to `:never`, the job will +# be enqueued immediately, even though the `Topic` hasn't been committed yet. +# Because of this, if the job is picked up almost immediately, or if the +# transaction doesn't succeed for some reason, the job will fail to find this +# topic in the database. +# +# If `enqueue_after_transaction_commit` is set to `:default`, the queue adapter +# will define the behaviour. +# +# Note: Active Job backends can disable this feature. This is generally done by +# backends that use the same database as Active Record as a queue, hence they +# don't need this feature. +#++ +# Rails.application.config.active_job.enqueue_after_transaction_commit = :default + +### +# Adds image/webp to the list of content types Active Storage considers as an image +# Prevents automatic conversion to a fallback PNG, and assumes clients support WebP, as they support gif, jpeg, and png. +# This is possible due to broad browser support for WebP, but older browsers and email clients may still not support +# WebP. Requires imagemagick/libvips built with WebP support. +#++ +# Rails.application.config.active_storage.web_image_content_types = %w[image/png image/jpeg image/gif image/webp] + +### +# Enable validation of migration timestamps. When set, an ActiveRecord::InvalidMigrationTimestampError +# will be raised if the timestamp prefix for a migration is more than a day ahead of the timestamp +# associated with the current time. This is done to prevent forward-dating of migration files, which can +# impact migration generation and other migration commands. +# +# Applications with existing timestamped migrations that do not adhere to the +# expected format can disable validation by setting this config to `false`. +#++ +# Rails.application.config.active_record.validate_migration_timestamps = true + +### +# Controls whether the PostgresqlAdapter should decode dates automatically with manual queries. +# +# Example: +# ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.select_value("select '2024-01-01'::date") #=> Date +# +# This query used to return a `String`. +#++ +# Rails.application.config.active_record.postgresql_adapter_decode_dates = true + +### +# Enables YJIT as of Ruby 3.3, to bring sizeable performance improvements. If you are +# deploying to a memory constrained environment you may want to set this to `false`. +#++ +# Rails.application.config.yjit = true diff --git a/config/puma.rb b/config/puma.rb index d9b3e83..03c166f 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,43 +1,34 @@ -# Puma can serve each request in a thread from an internal thread pool. -# The `threads` method setting takes two numbers: a minimum and maximum. -# Any libraries that use thread pools should be configured to match -# the maximum value specified for Puma. Default is set to 5 threads for minimum -# and maximum; this matches the default thread size of Active Record. -# -max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } -min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } -threads min_threads_count, max_threads_count +# This configuration file will be evaluated by Puma. The top-level methods that +# are invoked here are part of Puma's configuration DSL. For more information +# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html. -# Specifies the `worker_timeout` threshold that Puma will use to wait before -# terminating a worker in development environments. +# Puma starts a configurable number of processes (workers) and each process +# serves each request in a thread from an internal thread pool. # -worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development" - -# Specifies the `port` that Puma will listen on to receive requests; default is 3000. +# The ideal number of threads per worker depends both on how much time the +# application spends waiting for IO operations and on how much you wish to +# to prioritize throughput over latency. # -port ENV.fetch("PORT") { 3000 } - -# Specifies the `environment` that Puma will run in. +# As a rule of thumb, increasing the number of threads will increase how much +# traffic a given process can handle (throughput), but due to CRuby's +# Global VM Lock (GVL) it has diminishing returns and will degrade the +# response time (latency) of the application. # -environment ENV.fetch("RAILS_ENV") { "development" } - -# Specifies the `pidfile` that Puma will use. -pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } - -# Specifies the number of `workers` to boot in clustered mode. -# Workers are forked web server processes. If using threads and workers together -# the concurrency of the application would be max `threads` * `workers`. -# Workers do not work on JRuby or Windows (both of which do not support -# processes). +# The default is set to 3 threads as it's deemed a decent compromise between +# throughput and latency for the average Rails application. # -# workers ENV.fetch("WEB_CONCURRENCY") { 2 } +# Any libraries that use a connection pool or another resource pool should +# be configured to provide at least as many connections as the number of +# threads. This includes Active Record's `pool` parameter in `database.yml`. +threads_count = ENV.fetch("RAILS_MAX_THREADS", 3) +threads threads_count, threads_count -# Use the `preload_app!` method when specifying a `workers` number. -# This directive tells Puma to first boot the application and load code -# before forking the application. This takes advantage of Copy On Write -# process behavior so workers use less memory. -# -# preload_app! +# Specifies the `port` that Puma will listen on to receive requests; default is 3000. +port ENV.fetch("PORT", 3000) -# Allow puma to be restarted by `rails restart` command. +# Allow puma to be restarted by `bin/rails restart` command. plugin :tmp_restart + +# Specify the PID file. Defaults to tmp/pids/server.pid in development. +# In other environments, only set the PID file if requested. +pidfile ENV["PIDFILE"] if ENV["PIDFILE"] diff --git a/db/schema.rb b/db/schema.rb index 8d62735..a18d066 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_10_28_195502) do +ActiveRecord::Schema[7.2].define(version: 2024_10_28_195502) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" enable_extension "unaccent" diff --git a/public/404.html b/public/404.html index 9a48320..2be3af2 100644 --- a/public/404.html +++ b/public/404.html @@ -2,25 +2,66 @@ The page you were looking for doesn't exist (404) - - +
-

The page you were looking for doesn't exist.

-

You may have mistyped the address or the page may have moved.

+
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+

If you are the application owner check the logs for more information.

diff --git a/public/406-unsupported-browser.html b/public/406-unsupported-browser.html new file mode 100644 index 0000000..7cf1e16 --- /dev/null +++ b/public/406-unsupported-browser.html @@ -0,0 +1,66 @@ + + + + Your browser is not supported (406) + + + + + + +
+
+

Your browser is not supported.

+

Please upgrade your browser to continue.

+
+
+ + diff --git a/public/422.html b/public/422.html index 83660ab..c08eac0 100644 --- a/public/422.html +++ b/public/422.html @@ -2,25 +2,66 @@ The change you wanted was rejected (422) - - +
-

The change you wanted was rejected.

-

Maybe you tried to change something you didn't have access to.

+
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+

If you are the application owner check the logs for more information.

diff --git a/public/500.html b/public/500.html index b80307f..78a030a 100644 --- a/public/500.html +++ b/public/500.html @@ -2,25 +2,65 @@ We're sorry, but something went wrong (500) - - +
-

We're sorry, but something went wrong.

-

We've been notified about this issue and we'll take a look at it shortly.

+
+

We're sorry, but something went wrong.

+
+

If you are the application owner check the logs for more information.

diff --git a/public/icon.png b/public/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..f3b5abcbde91cf6d7a6a26e514eb7e30f476f950 GIT binary patch literal 5599 zcmeHL-D}fO6hCR_taXJlzs3}~RuB=Iujyo=i*=1|1FN%E=zNfMTjru|Q<6v{J{U!C zBEE}?j6I3sz>fzN!6}L_BKjcuASk~1;Dg|U_@d{g?V8mM`~#9U+>>*Ezw>c(PjYWA z4(;!cgge6k5E&d$G5`S-0}!Ik>CV(0Y#1}s-v_gAHhja2=W1?nBAte9D2HG<(+)uj z!5=W4u*{VKMw#{V@^NNs4TClr!FAA%ID-*gc{R%CFKEzG<6gm*9s_uy)oMGW*=nJf zw{(Mau|2FHfXIv6C0@Wk5k)F=3jo1srV-C{pl&k&)4_&JjYrnbJiul}d0^NCSh(#7h=F;3{|>EU>h z6U8_p;^wK6mAB(1b92>5-HxJ~V}@3?G`&Qq-TbJ2(&~-HsH6F#8mFaAG(45eT3VPO zM|(Jd<+;UZs;w>0Qw}0>D%{~r{uo_Fl5_Bo3ABWi zWo^j^_T3dxG6J6fH8X)$a^%TJ#PU!=LxF=#Fd9EvKx_x>q<(KY%+y-08?kN9dXjXK z**Q=yt-FTU*13ouhCdqq-0&;Ke{T3sQU9IdzhV9LhQIpq*P{N)+}|Mh+a-VV=x?R} c>%+pvTcMWshj-umO}|qP?%A)*_KlqT3uEqhU;qFB literal 0 HcmV?d00001 diff --git a/public/icon.svg b/public/icon.svg new file mode 100644 index 0000000..78307cc --- /dev/null +++ b/public/icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/robots.txt b/public/robots.txt index 085187f..c19f78a 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,5 +1 @@ -# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file -# -# To ban all spiders from the entire site uncomment the next two lines: -# User-Agent: * -# Disallow: / +# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file From 7cae9a40d3b19cf41192f47cc71292a93b4270ed Mon Sep 17 00:00:00 2001 From: Nat Budin Date: Mon, 28 Oct 2024 13:00:28 -0700 Subject: [PATCH 5/8] Update almost everything else --- Gemfile | 2 +- Gemfile.lock | 182 +++++++++++++++++++++++++++++---------------------- 2 files changed, 103 insertions(+), 81 deletions(-) diff --git a/Gemfile b/Gemfile index 00341a9..a105679 100644 --- a/Gemfile +++ b/Gemfile @@ -26,7 +26,7 @@ gem "coffee-rails" gem "jquery-rails" -gem "doorkeeper", "5.6.6" +gem "doorkeeper" gem "will_paginate" gem "will_paginate-bootstrap" diff --git a/Gemfile.lock b/Gemfile.lock index 4ae6ee0..00ffea7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -71,65 +71,81 @@ GEM minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) - addressable (2.8.1) - public_suffix (>= 2.0.2, < 6.0) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) ansi (1.5.0) - autoprefixer-rails (10.4.7.0) + autoprefixer-rails (10.4.19.0) execjs (~> 2) - aws-eventstream (1.2.0) - aws-partitions (1.830.0) - aws-record (2.12.0) + aws-eventstream (1.3.0) + aws-partitions (1.997.0) + aws-record (2.13.2) aws-sdk-dynamodb (~> 1, >= 1.85.0) - aws-sdk-core (3.184.0) - aws-eventstream (~> 1, >= 1.0.2) - aws-partitions (~> 1, >= 1.651.0) - aws-sigv4 (~> 1.5) + aws-sdk-core (3.211.0) + aws-eventstream (~> 1, >= 1.3.0) + aws-partitions (~> 1, >= 1.992.0) + aws-sigv4 (~> 1.9) jmespath (~> 1, >= 1.6.1) - aws-sdk-dynamodb (1.95.0) - aws-sdk-core (~> 3, >= 3.184.0) - aws-sigv4 (~> 1.1) - aws-sdk-rails (3.9.0) + aws-sdk-dynamodb (1.126.0) + aws-sdk-core (~> 3, >= 3.210.0) + aws-sigv4 (~> 1.5) + aws-sdk-kms (1.95.0) + aws-sdk-core (~> 3, >= 3.210.0) + aws-sigv4 (~> 1.5) + aws-sdk-rails (4.1.0) + actionmailbox (>= 7.0.0) aws-record (~> 2) + aws-sdk-s3 (~> 1, >= 1.123.0) aws-sdk-ses (~> 1, >= 1.50.0) aws-sdk-sesv2 (~> 1, >= 1.34.0) + aws-sdk-sns (~> 1, >= 1.61.0) aws-sdk-sqs (~> 1, >= 1.56.0) aws-sessionstore-dynamodb (~> 2) - concurrent-ruby (~> 1) - railties (>= 5.2.0) - aws-sdk-ses (1.56.0) - aws-sdk-core (~> 3, >= 3.184.0) - aws-sigv4 (~> 1.1) - aws-sdk-sesv2 (1.40.0) - aws-sdk-core (~> 3, >= 3.184.0) - aws-sigv4 (~> 1.1) - aws-sdk-sqs (1.63.0) - aws-sdk-core (~> 3, >= 3.184.0) - aws-sigv4 (~> 1.1) - aws-sessionstore-dynamodb (2.1.0) + concurrent-ruby (~> 1.3, >= 1.3.1) + railties (>= 7.0.0) + aws-sdk-s3 (1.169.0) + aws-sdk-core (~> 3, >= 3.210.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.5) + aws-sdk-ses (1.76.0) + aws-sdk-core (~> 3, >= 3.210.0) + aws-sigv4 (~> 1.5) + aws-sdk-sesv2 (1.65.0) + aws-sdk-core (~> 3, >= 3.210.0) + aws-sigv4 (~> 1.5) + aws-sdk-sns (1.89.0) + aws-sdk-core (~> 3, >= 3.210.0) + aws-sigv4 (~> 1.5) + aws-sdk-sqs (1.87.0) + aws-sdk-core (~> 3, >= 3.210.0) + aws-sigv4 (~> 1.5) + aws-sessionstore-dynamodb (2.2.0) aws-sdk-dynamodb (~> 1, >= 1.85.0) - rack (~> 2) - aws-sigv4 (1.6.0) + rack (>= 2, < 4) + rack-session (>= 1, < 3) + aws-sigv4 (1.10.1) aws-eventstream (~> 1, >= 1.0.2) base64 (0.2.0) bcrypt (3.1.20) - bcrypt_pbkdf (1.1.0) + bcrypt_pbkdf (1.1.1) bigdecimal (3.1.8) - bootsnap (1.15.0) + bootsnap (1.18.4) msgpack (~> 1.2) bootstrap-sass (3.4.1) autoprefixer-rails (>= 5.2.1) sassc (>= 2.0.0) builder (3.3.0) - cancancan (3.4.0) - capybara (3.38.0) + cancancan (3.6.1) + capybara (3.40.0) addressable matrix mini_mime (>= 0.1.3) - nokogiri (~> 1.8) + nokogiri (~> 1.11) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) + childprocess (5.1.0) + logger (~> 1.5) coderay (1.1.3) coffee-rails (5.0.0) coffee-script (>= 2.2.0) @@ -140,12 +156,13 @@ GEM coffee-script-source (1.12.2) concurrent-ruby (1.3.4) connection_pool (2.4.1) - crack (0.4.5) + crack (1.0.0) + bigdecimal rexml crass (1.0.6) - database_cleaner (2.0.1) - database_cleaner-active_record (~> 2.0.0) - database_cleaner-active_record (2.0.1) + database_cleaner (2.1.0) + database_cleaner-active_record (>= 2, < 3) + database_cleaner-active_record (2.2.0) activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) @@ -161,28 +178,30 @@ GEM devise_invitable (2.0.9) actionmailer (>= 5.0) devise (>= 4.6) - doorkeeper (5.6.6) + doorkeeper (5.7.1) railties (>= 5) drb (2.2.1) - dynamic_form (1.1.4) + dynamic_form (1.3.1) + actionview (> 5.2.0) + activemodel (> 5.2.0) ed25519 (1.3.0) erubi (1.13.0) - execjs (2.8.1) - factory_bot (6.2.1) + execjs (2.10.0) + factory_bot (6.5.0) activesupport (>= 5.0.0) - factory_bot_rails (6.2.0) - factory_bot (~> 6.2.0) + factory_bot_rails (6.4.4) + factory_bot (~> 6.5) railties (>= 5.0.0) - ffi (1.15.5) + ffi (1.17.0) figaro (1.2.0) thor (>= 0.14.0, < 2) globalid (1.2.1) activesupport (>= 6.1) - haml (6.1.1) + haml (6.3.0) temple (>= 0.8.2) thor tilt - hashdiff (1.0.1) + hashdiff (1.1.1) i18n (1.14.6) concurrent-ruby (~> 1.0) io-console (0.7.2) @@ -190,13 +209,14 @@ GEM rdoc (>= 4.0.0) reline (>= 0.4.2) jmespath (1.6.2) - jquery-rails (4.5.1) + jquery-rails (4.6.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - launchy (2.5.2) + launchy (3.0.1) addressable (~> 2.8) - listen (3.8.0) + childprocess (~> 5.0) + listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) logger (1.6.1) @@ -214,15 +234,15 @@ GEM mini_mime (1.1.5) mini_portile2 (2.8.7) minitest (5.25.1) - minitest-reporters (1.6.1) + minitest-reporters (1.7.1) ansi builder minitest (>= 5.0) ruby-progressbar - minitest-spec-rails (7.2.0) + minitest-spec-rails (7.3.0) minitest (>= 5.0) railties (>= 4.1) - msgpack (1.6.0) + msgpack (1.7.3) net-imap (0.5.0) date net-protocol @@ -237,29 +257,29 @@ GEM mini_portile2 (~> 2.8.2) racc (~> 1.4) orm_adapter (0.5.0) - pg (1.4.5) - pg_search (2.3.6) - activerecord (>= 5.2) - activesupport (>= 5.2) + pg (1.5.9) + pg_search (2.3.7) + activerecord (>= 6.1) + activesupport (>= 6.1) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - pry-rails (0.3.9) - pry (>= 0.10.4) + pry-rails (0.3.11) + pry (>= 0.13.0) psych (5.1.2) stringio - public_suffix (5.0.1) + public_suffix (6.0.1) puma (6.4.3) nio4r (~> 2.0) racc (1.8.1) - rack (2.2.10) - rack-session (1.0.2) - rack (< 3) + rack (3.1.8) + rack-session (2.0.0) + rack (>= 3.0.0) rack-test (2.1.0) rack (>= 1.3) - rackup (1.0.1) - rack (< 3) - webrick + rackup (2.1.0) + rack (>= 3) + webrick (~> 1.8) rails (7.2.1.2) actioncable (= 7.2.1.2) actionmailbox (= 7.2.1.2) @@ -295,18 +315,18 @@ GEM zeitwerk (~> 2.6) rake (13.2.1) rb-fsevent (0.11.2) - rb-inotify (0.10.1) + rb-inotify (0.11.1) ffi (~> 1.0) rdoc (6.7.0) psych (>= 4.0.0) - regexp_parser (2.6.1) + regexp_parser (2.9.2) reline (0.5.10) io-console (~> 0.5) responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) rexml (3.3.9) - rollbar (3.4.0) + rollbar (3.6.0) ruby-progressbar (1.13.0) rubyzip (2.3.2) sass-rails (6.0.0) @@ -320,25 +340,27 @@ GEM sprockets-rails tilt securerandom (0.3.1) - selenium-webdriver (4.7.1) + selenium-webdriver (4.25.0) + base64 (~> 0.2) + logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) - sprockets (4.2.0) + sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) + sprockets-rails (3.5.2) + actionpack (>= 6.1) + activesupport (>= 6.1) sprockets (>= 3.0.0) stringio (3.1.1) - temple (0.9.1) + temple (0.10.3) thor (1.3.2) - tilt (2.0.11) + tilt (2.4.0) timeout (0.4.1) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - uglifier (4.2.0) + uglifier (4.2.1) execjs (>= 0.3.0, < 3) useragent (0.16.10) warden (1.2.9) @@ -347,16 +369,16 @@ GEM nokogiri (~> 1.6) rubyzip (>= 1.3.0) selenium-webdriver (~> 4.0) - webmock (3.18.1) + webmock (3.24.0) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) webrick (1.8.2) - websocket (1.2.9) + websocket (1.2.11) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - will_paginate (3.3.1) + will_paginate (4.0.1) will_paginate-bootstrap (1.0.2) will_paginate (>= 3.0.3) xpath (3.2.0) @@ -379,7 +401,7 @@ DEPENDENCIES devise (~> 4.9) devise-encryptable devise_invitable (~> 2.0.9) - doorkeeper (= 5.6.6) + doorkeeper dynamic_form ed25519 factory_bot_rails From 19558b1f02ac3ffcb05a4fae32c38de02f168d5e Mon Sep 17 00:00:00 2001 From: Nat Budin Date: Mon, 28 Oct 2024 13:02:55 -0700 Subject: [PATCH 6/8] Don't require the library we removed --- lib/cassy/utils.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/cassy/utils.rb b/lib/cassy/utils.rb index d5dba91..f7b8f6a 100644 --- a/lib/cassy/utils.rb +++ b/lib/cassy/utils.rb @@ -1,5 +1,3 @@ -require 'crypt/isaac' - # Misc utility function used throughout by the RubyCAS-Server. module Cassy module Utils From b3e7e4facc756444802e60ad8f14c4675fbafb1e Mon Sep 17 00:00:00 2001 From: Nat Budin Date: Mon, 28 Oct 2024 13:10:28 -0700 Subject: [PATCH 7/8] Fix naming for Zeitwerk --- app/helpers/cas_helper.rb | 2 +- config/initializers/inflections.rb | 6 +++--- lib/cassy/cas.rb | 5 ++++- lib/cassy/models.rb | 5 ----- lib/cassy/routes.rb | 32 ++++++++++++++++------------ lib/illyan/strategies.rb | 3 +++ lib/illyan/strategies/legacy_md5.rb | 13 ++++++----- lib/illyan/strategies/legacy_sha1.rb | 13 ++++++----- 8 files changed, 45 insertions(+), 34 deletions(-) delete mode 100644 lib/cassy/models.rb diff --git a/app/helpers/cas_helper.rb b/app/helpers/cas_helper.rb index f369992..1d005e5 100644 --- a/app/helpers/cas_helper.rb +++ b/app/helpers/cas_helper.rb @@ -1,2 +1,2 @@ -module CasHelper +module CASHelper end diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 3860f65..8039b51 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -11,6 +11,6 @@ # end # These inflection rules are supported but not enabled by default: -# ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.acronym "RESTful" -# end +ActiveSupport::Inflector.inflections(:en) do |inflect| + inflect.acronym "CAS" +end diff --git a/lib/cassy/cas.rb b/lib/cassy/cas.rb index a47e345..c4607f2 100644 --- a/lib/cassy/cas.rb +++ b/lib/cassy/cas.rb @@ -1,7 +1,10 @@ require 'uri' require 'net/https' -require 'cassy/models' +Dir[Cassy.root + "app/models/cassy/*.rb"].each do |file| + require f +end + require 'cassy/utils' # Encapsulates CAS functionality. This module is meant to be included in diff --git a/lib/cassy/models.rb b/lib/cassy/models.rb deleted file mode 100644 index a520c24..0000000 --- a/lib/cassy/models.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'cassy' - -Dir[Cassy.root + "app/models/cassy/*.rb"].each do |file| - require f -end \ No newline at end of file diff --git a/lib/cassy/routes.rb b/lib/cassy/routes.rb index 2e97b74..f65c1a2 100644 --- a/lib/cassy/routes.rb +++ b/lib/cassy/routes.rb @@ -1,17 +1,21 @@ +module Cassy::Routes + def cassy(options={}) + options[:controllers] ||= HashWithIndifferentAccess.new + options[:controllers][:sessions] ||= "cassy/sessions" + scope(:path => "cas") do + get 'login', :to => "#{options[:controllers][:sessions]}#new" + post 'login', :to => "#{options[:controllers][:sessions]}#create" + + get 'logout', :to => "#{options[:controllers][:sessions]}#destroy" + + get 'serviceValidate', :to => "#{options[:controllers][:sessions]}#service_validate" + get 'proxyValidate', :to => "#{options[:controllers][:sessions]}#proxy_validate" + end + end +end + module ActionDispatch::Routing class Mapper - def cassy(options={}) - options[:controllers] ||= HashWithIndifferentAccess.new - options[:controllers][:sessions] ||= "cassy/sessions" - scope(:path => "cas") do - get 'login', :to => "#{options[:controllers][:sessions]}#new" - post 'login', :to => "#{options[:controllers][:sessions]}#create" - - get 'logout', :to => "#{options[:controllers][:sessions]}#destroy" - - get 'serviceValidate', :to => "#{options[:controllers][:sessions]}#service_validate" - get 'proxyValidate', :to => "#{options[:controllers][:sessions]}#proxy_validate" - end - end + include Cassy::Routes end -end \ No newline at end of file +end diff --git a/lib/illyan/strategies.rb b/lib/illyan/strategies.rb index caafec8..84d46df 100644 --- a/lib/illyan/strategies.rb +++ b/lib/illyan/strategies.rb @@ -1,2 +1,5 @@ +module Illyan::Strategies +end + require 'illyan/strategies/legacy_md5' require 'illyan/strategies/legacy_sha1' diff --git a/lib/illyan/strategies/legacy_md5.rb b/lib/illyan/strategies/legacy_md5.rb index f205b8b..80d247b 100644 --- a/lib/illyan/strategies/legacy_md5.rb +++ b/lib/illyan/strategies/legacy_md5.rb @@ -1,9 +1,12 @@ +module Illyan::Strategies::LegacyMd5 +end + module Devise module Models - module LegacyMd5Authenticatable + module LegacyMd5Authenticatable end end - + module Strategies class LegacyMD5Authenticatable < Devise::Strategies::Base def valid? @@ -17,14 +20,14 @@ def authenticate! pass else if Digest::MD5.hexdigest(params[scope]["password"]) == p.legacy_password_md5 - + # save password as non-legacy version for next time p.password = params[scope]["password"] p.legacy_password_md5 = nil unless p.save Rails.logger.warn "Couldn't save non-legacy password for #{p.name}: #{p.errors.full_messages.join(", ")}" end - + success!(p) else pass @@ -36,4 +39,4 @@ def authenticate! end Warden::Strategies.add(:legacy_md5_authenticatable, Devise::Strategies::LegacyMD5Authenticatable) -Devise.add_module(:legacy_md5_authenticatable, :strategy => true) \ No newline at end of file +Devise.add_module(:legacy_md5_authenticatable, :strategy => true) diff --git a/lib/illyan/strategies/legacy_sha1.rb b/lib/illyan/strategies/legacy_sha1.rb index b474910..db5da22 100644 --- a/lib/illyan/strategies/legacy_sha1.rb +++ b/lib/illyan/strategies/legacy_sha1.rb @@ -1,9 +1,12 @@ +module Illyan::Strategies::LegacySha1 +end + module Devise module Models - module LegacySha1Authenticatable + module LegacySha1Authenticatable end end - + module Strategies class LegacySha1Authenticatable < Devise::Strategies::Base def valid? @@ -18,14 +21,14 @@ def authenticate! else sha1_digest = Devise::Encryptable::Encryptors::Sha1.digest(params[scope]["password"], 10, p.legacy_password_sha1_salt, mapping.to.pepper) if sha1_digest == p.legacy_password_sha1 - + # save password as non-legacy version for next time p.password = params[scope]["password"] p.legacy_password_sha1 = "" unless p.save Rails.logger.warn "Couldn't save non-legacy password for #{p.name}: #{p.errors.full_messages.join(", ")}" end - + success!(p) else pass @@ -37,4 +40,4 @@ def authenticate! end Warden::Strategies.add(:legacy_sha1_authenticatable, Devise::Strategies::LegacySha1Authenticatable) -Devise.add_module(:legacy_sha1_authenticatable, :strategy => true) \ No newline at end of file +Devise.add_module(:legacy_sha1_authenticatable, :strategy => true) From d878efdf616cd2243878331f57addc4e6c86441a Mon Sep 17 00:00:00 2001 From: Nat Budin Date: Mon, 28 Oct 2024 13:15:25 -0700 Subject: [PATCH 8/8] Uglifier -> Terser --- Gemfile | 2 +- Gemfile.lock | 6 +++--- config/environments/production.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index a105679..f7c9828 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ gem "haml" gem "sprockets-rails" gem "sprockets" gem "sass-rails" -gem "uglifier" +gem "terser" gem "bootstrap-sass", "~> 3.4.1" gem "autoprefixer-rails" gem "coffee-rails" diff --git a/Gemfile.lock b/Gemfile.lock index 00ffea7..f8d32ed 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -355,13 +355,13 @@ GEM sprockets (>= 3.0.0) stringio (3.1.1) temple (0.10.3) + terser (1.2.4) + execjs (>= 0.3.0, < 3) thor (1.3.2) tilt (2.4.0) timeout (0.4.1) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - uglifier (4.2.1) - execjs (>= 0.3.0, < 3) useragent (0.16.10) warden (1.2.9) rack (>= 2.0.9) @@ -424,7 +424,7 @@ DEPENDENCIES selenium-webdriver sprockets sprockets-rails - uglifier + terser webdrivers webmock will_paginate diff --git a/config/environments/production.rb b/config/environments/production.rb index 74ff15a..8da08a0 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -26,7 +26,7 @@ config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? # Compress JavaScripts and CSS. - config.assets.js_compressor = Uglifier.new(harmony: true) + config.assets.js_compressor = :terser config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed.