From 333e563db65ac7b4a9952f8d4cb094a65c3fd5c8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Aug 2024 09:32:09 +0000 Subject: [PATCH 01/14] Bump rails from 7.1.3.4 to 7.2.0 Bumps [rails](https://github.com/rails/rails) from 7.1.3.4 to 7.2.0. - [Release notes](https://github.com/rails/rails/releases) - [Commits](https://github.com/rails/rails/compare/v7.1.3.4...v7.2.0) --- updated-dependencies: - dependency-name: rails dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 138 +++++++++++++++++++++++++-------------------------- 2 files changed, 69 insertions(+), 71 deletions(-) diff --git a/Gemfile b/Gemfile index f32f81c44c..1aefb6a791 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '3.2.4' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '7.1.3.4' +gem 'rails', '7.2.0' # Use PostgreSQL as the database for Active Record gem 'pg' diff --git a/Gemfile.lock b/Gemfile.lock index 16e3a4e784..0ce3d65f83 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -54,51 +54,46 @@ GEM specs: aasm (5.5.0) concurrent-ruby (~> 1.0) - actioncable (7.1.3.4) - actionpack (= 7.1.3.4) - activesupport (= 7.1.3.4) + actioncable (7.2.0) + actionpack (= 7.2.0) + activesupport (= 7.2.0) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.3.4) - actionpack (= 7.1.3.4) - activejob (= 7.1.3.4) - activerecord (= 7.1.3.4) - activestorage (= 7.1.3.4) - activesupport (= 7.1.3.4) - mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.1.3.4) - actionpack (= 7.1.3.4) - actionview (= 7.1.3.4) - activejob (= 7.1.3.4) - activesupport (= 7.1.3.4) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp + actionmailbox (7.2.0) + actionpack (= 7.2.0) + activejob (= 7.2.0) + activerecord (= 7.2.0) + activestorage (= 7.2.0) + activesupport (= 7.2.0) + mail (>= 2.8.0) + actionmailer (7.2.0) + actionpack (= 7.2.0) + actionview (= 7.2.0) + activejob (= 7.2.0) + activesupport (= 7.2.0) + mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.1.3.4) - actionview (= 7.1.3.4) - activesupport (= 7.1.3.4) + actionpack (7.2.0) + actionview (= 7.2.0) + activesupport (= 7.2.0) 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.3.4) - actionpack (= 7.1.3.4) - activerecord (= 7.1.3.4) - activestorage (= 7.1.3.4) - activesupport (= 7.1.3.4) + useragent (~> 0.16) + actiontext (7.2.0) + actionpack (= 7.2.0) + activerecord (= 7.2.0) + activestorage (= 7.2.0) + activesupport (= 7.2.0) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.3.4) - activesupport (= 7.1.3.4) + actionview (7.2.0) + activesupport (= 7.2.0) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) @@ -108,35 +103,36 @@ GEM activemodel (>= 4.1) case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.3) - activejob (7.1.3.4) - activesupport (= 7.1.3.4) + activejob (7.2.0) + activesupport (= 7.2.0) globalid (>= 0.3.6) - activemodel (7.1.3.4) - activesupport (= 7.1.3.4) + activemodel (7.2.0) + activesupport (= 7.2.0) activemodel-serializers-xml (1.0.2) activemodel (> 5.x) activesupport (> 5.x) builder (~> 3.1) - activerecord (7.1.3.4) - activemodel (= 7.1.3.4) - activesupport (= 7.1.3.4) + activerecord (7.2.0) + activemodel (= 7.2.0) + activesupport (= 7.2.0) timeout (>= 0.4.0) - activestorage (7.1.3.4) - actionpack (= 7.1.3.4) - activejob (= 7.1.3.4) - activerecord (= 7.1.3.4) - activesupport (= 7.1.3.4) + activestorage (7.2.0) + actionpack (= 7.2.0) + activejob (= 7.2.0) + activerecord (= 7.2.0) + activesupport (= 7.2.0) marcel (~> 1.0) - activesupport (7.1.3.4) + activesupport (7.2.0) 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.7) public_suffix (>= 2.0.2, < 7.0) aes_key_wrap (1.1.0) @@ -144,9 +140,9 @@ GEM ast (2.4.2) attr_extras (7.1.0) attr_required (1.0.2) - audited (5.4.3) - activerecord (>= 5.0, < 7.2) - request_store (~> 1.2) + audited (5.7.0) + activerecord (>= 5.2, < 8.0) + activesupport (>= 5.2, < 8.0) awesome_print (1.9.2) base64 (0.2.0) better_errors (2.10.1) @@ -554,20 +550,20 @@ GEM rackup (1.0.0) rack (< 3) webrick - rails (7.1.3.4) - actioncable (= 7.1.3.4) - actionmailbox (= 7.1.3.4) - actionmailer (= 7.1.3.4) - actionpack (= 7.1.3.4) - actiontext (= 7.1.3.4) - actionview (= 7.1.3.4) - activejob (= 7.1.3.4) - activemodel (= 7.1.3.4) - activerecord (= 7.1.3.4) - activestorage (= 7.1.3.4) - activesupport (= 7.1.3.4) + rails (7.2.0) + actioncable (= 7.2.0) + actionmailbox (= 7.2.0) + actionmailer (= 7.2.0) + actionpack (= 7.2.0) + actiontext (= 7.2.0) + actionview (= 7.2.0) + activejob (= 7.2.0) + activemodel (= 7.2.0) + activerecord (= 7.2.0) + activestorage (= 7.2.0) + activesupport (= 7.2.0) bundler (>= 1.15.0) - railties (= 7.1.3.4) + railties (= 7.2.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -588,10 +584,10 @@ GEM rack railties (>= 5.1) semantic_logger (~> 4.16) - railties (7.1.3.4) - actionpack (= 7.1.3.4) - activesupport (= 7.1.3.4) - irb + railties (7.2.0) + actionpack (= 7.2.0) + activesupport (= 7.2.0) + irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) @@ -682,6 +678,7 @@ GEM safely_block (0.4.0) schema_to_scaffold (0.8.2) activesupport (~> 7) + securerandom (0.3.1) semantic_logger (4.16.0) concurrent-ruby (~> 1.0) sentry-rails (5.19.0) @@ -754,6 +751,7 @@ GEM unicode-display_width (2.5.0) uniform_notifier (1.16.0) uri (0.13.0) + useragent (0.16.10) validate_url (1.0.15) activemodel (>= 3.0.0) public_suffix @@ -860,7 +858,7 @@ DEPENDENCIES puma (~> 6.4) pundit rack-cors - rails (= 7.1.3.4) + rails (= 7.2.0) rails-controller-testing rails-erd rails_semantic_logger From 61b3e966053045b740596e3a458f7d615590da34 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Mon, 2 Sep 2024 17:03:26 +0100 Subject: [PATCH 02/14] Update database_cleaner to the latest version Was previously getting the following error: An error occurred in a `before(:suite)` hook. Failure/Error: DatabaseCleaner.clean_with(:truncation) NoMethodError: undefined method `schema_migration' for # # ./spec/rails_helper.rb:64:in `block (2 levels) in ' --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0ce3d65f83..d45a59cc4f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -211,7 +211,7 @@ GEM railties (>= 6.1) database_cleaner (2.0.2) database_cleaner-active_record (>= 2, < 3) - database_cleaner-active_record (2.1.0) + database_cleaner-active_record (2.2.0) activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) @@ -420,7 +420,7 @@ GEM llhttp-ffi (0.5.0) ffi-compiler (~> 1.0) rake (~> 13.0) - logger (1.6.0) + logger (1.6.1) loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) From 4e4eb802cfa1c4af9b78305cb524005d15293bf7 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Mon, 2 Sep 2024 17:17:08 +0100 Subject: [PATCH 03/14] Include ActiveModel::Model This wil give us the validates method. This was previously failing with: An error occurred while loading ./spec/validators/phone_validator_spec.rb. Failure/Error: validates :phone_number, phone: true --- spec/validators/email_address_validator_spec.rb | 2 +- spec/validators/phone_validator_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/validators/email_address_validator_spec.rb b/spec/validators/email_address_validator_spec.rb index 1d720544f4..fb546713a2 100644 --- a/spec/validators/email_address_validator_spec.rb +++ b/spec/validators/email_address_validator_spec.rb @@ -7,7 +7,7 @@ let(:model) do Class.new do - include ActiveRecord::Validations + include ActiveModel::Model attr_accessor :email diff --git a/spec/validators/phone_validator_spec.rb b/spec/validators/phone_validator_spec.rb index 1228fe8a1d..ba8c215cc6 100644 --- a/spec/validators/phone_validator_spec.rb +++ b/spec/validators/phone_validator_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' class PhoneValidatorTest - include ActiveRecord::Validations + include ActiveModel::Model attr_accessor :phone_number From 4a63fe2170695b4285e1283aec8484353271aaad Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Tue, 3 Sep 2024 12:23:45 +0100 Subject: [PATCH 04/14] Generate brakeman file --- bin/brakeman | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 bin/brakeman diff --git a/bin/brakeman b/bin/brakeman new file mode 100755 index 0000000000..ace1c9ba08 --- /dev/null +++ b/bin/brakeman @@ -0,0 +1,7 @@ +#!/usr/bin/env ruby +require "rubygems" +require "bundler/setup" + +ARGV.unshift("--ensure-latest") + +load Gem.bin_path("brakeman", "brakeman") From ed4ed80eac4a6bf04538b29b7d7b37ee8a563d4b Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Tue, 3 Sep 2024 12:24:14 +0100 Subject: [PATCH 05/14] Generate rubocop --- bin/rubocop | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 bin/rubocop diff --git a/bin/rubocop b/bin/rubocop new file mode 100755 index 0000000000..40330c0ff1 --- /dev/null +++ b/bin/rubocop @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby +require "rubygems" +require "bundler/setup" + +# explicit rubocop config increases performance slightly while avoiding config confusion. +ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__)) + +load Gem.bin_path("rubocop", "rubocop") From 7a2527323416ddfa35b937d848f218b19775b8fb Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Tue, 3 Sep 2024 12:27:28 +0100 Subject: [PATCH 06/14] Generate setup file --- bin/setup | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/setup b/bin/setup index 21f8ff6995..50b4155338 100755 --- a/bin/setup +++ b/bin/setup @@ -3,6 +3,7 @@ require "fileutils" # path to your application root. APP_ROOT = File.expand_path("..", __dir__) +APP_NAME = "manage-courses-backend" def system!(*args) system(*args, exception: true) @@ -44,4 +45,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 From 6c533043d4149081a650557c16b54787266e890b Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Tue, 3 Sep 2024 12:36:32 +0100 Subject: [PATCH 07/14] Generate development.rb --- config/environments/development.rb | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/config/environments/development.rb b/config/environments/development.rb index ff87b17a44..e81ccea23d 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -16,7 +16,7 @@ # Show full error reports. config.consider_all_requests_local = true - # Enable server timing + # Enable server timing. config.server_timing = true # Enable/disable caching. By default caching is disabled. @@ -26,23 +26,22 @@ config.action_controller.enable_fragment_cache_logging = true config.cache_store = :memory_store - config.public_file_server.headers = { - "Cache-Control" => "public, max-age=#{2.days.to_i}" - } + config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" } else config.action_controller.perform_caching = false config.cache_store = :null_store end - # Store uploaded files on the local file system (see config/storage.yml for options). - # config.active_storage.service = :local - # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false + # Disable caching for Action Mailer templates even if Action Controller + # caching is enabled. config.action_mailer.perform_caching = false + config.action_mailer.default_url_options = { host: "localhost", port: 3001 } + # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log @@ -74,12 +73,12 @@ # Annotate rendered view with file names. config.action_view.annotate_rendered_view_with_filenames = true - # Uncomment if you wish to allow Action Cable access from any origin. - # config.action_cable.disable_request_forgery_protection = true - - # Raise error when a before_action's only/except options reference missing actions + # Raise error when a before_action's only/except options reference missing actions. config.action_controller.raise_on_missing_callback_actions = true + # Apply autocorrection by RuboCop to files generated by `bin/rails generate`. + # config.generators.apply_rubocop_autocorrect_after_generate! + config.authentication_token = ENV.fetch('AUTHENTICATION_TOKEN', 'bats') config.x.read_only_database_url = "postgres://localhost/#{ENV.fetch('DB_DATABASE', 'manage_courses_backend_development')}" From 9618a1b94b1944171ab630ca2e02f3145fa71359 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Tue, 3 Sep 2024 12:49:46 +0100 Subject: [PATCH 08/14] Update production This looks the config.x was work around from a while ago. The automated generator has removed it. --- config/environments/production.rb | 34 +++---------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 9e3c48d8d6..95594b2ea1 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -3,8 +3,6 @@ require "active_support/core_ext/integer/time" Rails.application.configure do - config.x.read_only_database_url = ENV.fetch('DATABASE_URL', nil) - # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. @@ -34,20 +32,12 @@ config.assets.compile = false # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = proc { |_source, request| } + # config.asset_host = "http://assets.example.com" # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX - # Store uploaded files on the local file system (see config/storage.yml for options). - # config.active_storage.service = :local - - # Mount Action Cable outside main process or domain. - # config.action_cable.mount_path = nil - # config.action_cable.url = "wss://example.com/cable" - # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ] - # Assume all access to the app is happening through a SSL-terminating reverse proxy. # Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies. # config.assume_ssl = true @@ -75,6 +65,8 @@ # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "manage_courses_backend_production" + # Disable caching for Action Mailer templates even if Action Controller + # caching is enabled. config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. @@ -93,26 +85,6 @@ config.authentication_token = ENV.fetch('AUTHENTICATION_TOKEN', nil) - # Inserts middleware to perform automatic connection switching. - # The `database_selector` hash is used to pass options to the DatabaseSelector - # middleware. The `delay` is used to determine how long to wait after a write - # to send a subsequent read to the primary. - # - # The `database_resolver` class is used by the middleware to determine which - # database is appropriate to use based on the time delay. - # - # The `database_resolver_context` class is used by the middleware to set - # timestamps for the last write to the primary. The resolver uses the context - # class timestamps to determine how long to wait before reading from the - # replica. - # - # By default Rails will store a last write timestamp in the session. The - # DatabaseSelector middleware is designed as such you can define your own - # strategy for connection switching and pass that into the middleware through - # these configuration options. - # config.active_record.database_selector = { delay: 2.seconds } - # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver - # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session # Enable DNS rebinding protection and other `Host` header attacks. # config.hosts = [ # "example.com", # Allow requests from example.com From d660f9383d06d6439b722493e6705c36a435da57 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Tue, 3 Sep 2024 12:56:13 +0100 Subject: [PATCH 09/14] Generate test.rb --- config/environments/test.rb | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/config/environments/test.rb b/config/environments/test.rb index e2280d94e4..b72d6ce9b5 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -20,10 +20,7 @@ config.eager_load = ENV["CI"].present? # Configure public file server for tests with Cache-Control for performance. - config.public_file_server.enabled = true - config.public_file_server.headers = { - "Cache-Control" => "public, max-age=#{1.hour.to_i}" - } + config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{1.hour.to_i}" } # Show full error reports and disable caching. config.consider_all_requests_local = true @@ -36,9 +33,8 @@ # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false - # Store uploaded files on the local file system in a temporary directory. - # config.active_storage.service = :test - + # Disable caching for Action Mailer templates even if Action Controller + # caching is enabled. config.action_mailer.perform_caching = false # Tell Action Mailer not to deliver emails to the real world. @@ -46,6 +42,10 @@ # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test + # Unlike controllers, the mailer instance doesn't have any context about the + # incoming request so you'll need to provide the :host parameter yourself. + config.action_mailer.default_url_options = { host: "www.example.com" } + # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr @@ -72,8 +72,6 @@ # Annotate rendered view with file names. # config.action_view.annotate_rendered_view_with_filenames = true - # Raise error when a before_action's only/except options reference missing actions + # Raise error when a before_action's only/except options reference missing actions. config.action_controller.raise_on_missing_callback_actions = true - - config.x.read_only_database_url = "postgres://localhost/#{ENV.fetch('DB_DATABASE', 'manage_courses_backend_test')}" end From ed4d72f5edcde6c9a2d32a1688719cfc9ea81d34 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Tue, 3 Sep 2024 13:03:02 +0100 Subject: [PATCH 10/14] Filter new params --- config/initializers/filter_parameter_logging.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index cbed8c5fd0..97fddf501e 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -2,5 +2,9 @@ # Be sure to restart your server when you modify this file. -# Configure sensitive parameters which will be filtered from the log file. -Rails.application.config.filter_parameters += %i[password email first_name last_name] +# 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, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :password, :email, :first_name, :last_name +] From 1a7e93a9ec3b04588e02f04742c3826c88146dc0 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Tue, 3 Sep 2024 13:05:43 +0100 Subject: [PATCH 11/14] Update robots.txt --- public/robots.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/robots.txt b/public/robots.txt index e0e33d8b4b..358457a4dc 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,4 +1,4 @@ -# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file +# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file User-agent: * Disallow: / Allow: https://find-teacher-training-courses.service.gov.uk/sitemap.xml From 726e097bc4b703925942136230cc3c0d6768e44a Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Tue, 3 Sep 2024 13:08:49 +0100 Subject: [PATCH 12/14] Rubocop autocorrects --- config/initializers/filter_parameter_logging.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 97fddf501e..adcd9bc9d9 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -5,6 +5,6 @@ # 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, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :password, :email, :first_name, :last_name +Rails.application.config.filter_parameters += %i[ + passw email secret token _key crypt salt certificate otp ssn password email first_name last_name ] From 268c4a0dc6c15317bdcfd142abb617efbf866b24 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Tue, 3 Sep 2024 14:58:12 +0100 Subject: [PATCH 13/14] Update defaults to 7.2 --- config/application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 974f5a7dba..dfab78084a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -20,7 +20,7 @@ module ManageCoursesBackend class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 7.1 + config.load_defaults 7.2 # 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. From 4c12fceeeff54904dad3ac4c75050f527c9c0399 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Tue, 3 Sep 2024 16:26:06 +0100 Subject: [PATCH 14/14] PR Feedback: https://github.com/DFE-Digital/publish-teacher-training/pull/4445#discussion_r1742249859 https://github.com/DFE-Digital/publish-teacher-training/pull/4445#discussion_r1742251224 https://github.com/DFE-Digital/publish-teacher-training/pull/4445#discussion_r1742251585 --- config/environments/production.rb | 1 + config/environments/test.rb | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/config/environments/production.rb b/config/environments/production.rb index 95594b2ea1..66bd4f0fec 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -3,6 +3,7 @@ require "active_support/core_ext/integer/time" Rails.application.configure do + config.x.read_only_database_url = ENV.fetch('DATABASE_URL', nil) # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. diff --git a/config/environments/test.rb b/config/environments/test.rb index b72d6ce9b5..743056ba0d 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -20,6 +20,8 @@ config.eager_load = ENV["CI"].present? # Configure public file server for tests with Cache-Control for performance. + config.public_file_server.enabled = true + config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{1.hour.to_i}" } # Show full error reports and disable caching. @@ -74,4 +76,6 @@ # Raise error when a before_action's only/except options reference missing actions. config.action_controller.raise_on_missing_callback_actions = true + + config.x.read_only_database_url = "postgres://localhost/#{ENV.fetch('DB_DATABASE', 'manage_courses_backend_test')}" end