The server cannot process the request due to a client error. Please check the request and try again. If you’re the application owner check the logs for more information.
+diff --git a/.github/workflows/brakeman-analysis.yml b/.github/workflows/brakeman-analysis.yml index c91f8355..da55b1cf 100644 --- a/.github/workflows/brakeman-analysis.yml +++ b/.github/workflows/brakeman-analysis.yml @@ -25,13 +25,13 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: "3.2" + ruby-version: "3.4" - name: Setup Brakeman env: - BRAKEMAN_VERSION: "6.2.1" # SARIF support is provided in Brakeman version 4.10+ + BRAKEMAN_VERSION: "7.1.0" # SARIF support is provided in Brakeman version 4.10+ run: | - gem install brakeman --version $BRAKEMAN_VERSION + gem install brakeman --version $BRAKEMAN_VERSION --no-document # Execute Brakeman CLI and generate a SARIF output with the security issues identified during the analysis - name: Scan diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fdd3284f..b164208d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,7 @@ jobs: - "3.4" rails: - "7.2" + - "8.0" database: - mysql - postgresql @@ -86,7 +87,7 @@ jobs: run: bundle exec rspec - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v5 - if: matrix.rails == '7.2' && matrix.ruby == '3.4' + if: matrix.rails == '8.0' && matrix.ruby == '3.4' with: token: ${{ secrets.CODECOV_TOKEN }} slug: AlchemyCMS/alchemy-devise @@ -106,7 +107,7 @@ jobs: - name: Install Ruby and gems uses: ruby/setup-ruby@v1 with: - ruby-version: "3.1" + ruby-version: "3.4" bundler-cache: true - name: Lint Ruby files run: bundle exec standardrb diff --git a/Gemfile b/Gemfile index 54f2237b..517f7972 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ source "https://rubygems.org" alchemy_branch = ENV.fetch("ALCHEMY_BRANCH", "main") gem "alchemy_cms", github: "AlchemyCMS/alchemy_cms", branch: alchemy_branch -rails_version = ENV.fetch("RAILS_VERSION", "7.2") +rails_version = ENV.fetch("RAILS_VERSION", "8.0") gem "rails", "~> #{rails_version}.0" gem "listen", "~> 3.8" gem "puma", "~> 7.0" diff --git a/app/assets/builds/alchemy-devise.css b/app/assets/builds/alchemy-devise.css index 9483b2a9..ba0bf5f5 100644 --- a/app/assets/builds/alchemy-devise.css +++ b/app/assets/builds/alchemy-devise.css @@ -1 +1 @@ -body.user_sessions #errors,body.user_sessions .message.info,body.passwords #errors,body.passwords .message.info{border-color:rgba(0,0,0,0)}body.user_sessions #errors,body.passwords #errors{margin-left:157px}.logo-box{width:250px;margin:0 10px 1.5em 200px}.logo-box svg{width:200px;height:auto}.login_signup_box{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.login_signup_box alchemy-message{margin-left:var(--form-left-column-width)}.no-js .login_signup_box{display:none}.login_signup_box .message{margin-left:157px}.login_signup_box .submit{display:flex;align-items:center;justify-content:space-between;gap:var(--spacing-4);margin-left:var(--form-left-column-width);padding-left:var(--spacing-0)}.login_signup_box .submit>a{display:inline-flex;align-items:center;gap:var(--spacing-0)}.login_signup_box .submit>a:hover alchemy-icon{transform:translateX(-2px);transition:transform var(--transition-duration)} +body.user_sessions #errors,body.user_sessions .message.info,body.passwords #errors,body.passwords .message.info{border-color:rgba(0,0,0,0)}body.user_sessions #errors,body.passwords #errors{margin-left:157px}.logo-box{width:250px;margin:0 10px 1.5em 200px}.logo-box svg{width:200px;height:auto}.login_signup_box{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.login_signup_box alchemy-message{width:300px;margin-left:var(--form-left-column-width)}.no-js .login_signup_box{display:none}.login_signup_box .message{margin-left:157px}.login_signup_box .submit{display:flex;align-items:center;justify-content:space-between;gap:var(--spacing-4);margin-left:var(--form-left-column-width);padding-left:var(--spacing-0)}.login_signup_box .submit.align-right{justify-content:end}.login_signup_box .submit>label{text-align:start}.login_signup_box .submit>label input[type=checkbox]{margin:0 var(--spacing-0) 0 0}.login_signup_box .submit>a{display:inline-flex;align-items:center;gap:var(--spacing-0)}.login_signup_box .submit>a:hover alchemy-icon{transform:translateX(-2px);transition:transform var(--transition-duration)} diff --git a/app/assets/stylesheets/alchemy-devise/login.scss b/app/assets/stylesheets/alchemy-devise/login.scss index abce7588..888dd9b6 100644 --- a/app/assets/stylesheets/alchemy-devise/login.scss +++ b/app/assets/stylesheets/alchemy-devise/login.scss @@ -27,6 +27,7 @@ body.passwords { transform: translate(-50%, -50%); alchemy-message { + width: 300px; margin-left: var(--form-left-column-width); } @@ -46,6 +47,18 @@ body.passwords { margin-left: var(--form-left-column-width); padding-left: var(--spacing-0); + &.align-right { + justify-content: end; + } + + > label { + text-align: start; + + input[type="checkbox"] { + margin: 0 var(--spacing-0) 0 0; + } + } + > a { display: inline-flex; align-items: center; diff --git a/app/controllers/alchemy/admin/users_controller.rb b/app/controllers/alchemy/admin/users_controller.rb index 1e228030..c82035cc 100644 --- a/app/controllers/alchemy/admin/users_controller.rb +++ b/app/controllers/alchemy/admin/users_controller.rb @@ -98,7 +98,7 @@ def signup_admin_or_redirect deliver_welcome_mail redirect_to admin_pages_path else - render :signup + render :signup, status: :unprocessable_entity end end diff --git a/app/models/alchemy/user.rb b/app/models/alchemy/user.rb index f7532182..91e385d3 100644 --- a/app/models/alchemy/user.rb +++ b/app/models/alchemy/user.rb @@ -25,7 +25,7 @@ class User < ActiveRecord::Base has_many :folded_pages - validates_uniqueness_of :login + validates :login, uniqueness: {case_sensitive: false}, presence: :login_required? validates_presence_of :alchemy_roles # Unlock all locked pages before destroy. @@ -140,6 +140,14 @@ def fullname(options = {}) alias_method :name, :fullname alias_method :alchemy_display_name, :fullname + def email_required? + ::Devise.authentication_keys.include?(:email) + end + + def login_required? + ::Devise.authentication_keys.include?(:login) + end + # Returns true if the last request not longer ago then the logged_in_time_out def logged_in? raise "Can not determine the records login state because there is no last_request_at column" if !respond_to?(:last_request_at) diff --git a/app/views/alchemy/admin/passwords/edit.html.erb b/app/views/alchemy/admin/passwords/edit.html.erb index f195e3a0..95acba13 100644 --- a/app/views/alchemy/admin/passwords/edit.html.erb +++ b/app/views/alchemy/admin/passwords/edit.html.erb @@ -18,8 +18,10 @@ <% end %> <%= alchemy_form_for resource, as: resource_name, url: admin_update_password_path, method: 'patch' do |f| %> <%= f.hidden_field :reset_password_token %> - <%= f.input :password, autofocus: true, label: Alchemy.t("New password") %> - <%= f.input :password_confirmation, label: Alchemy.t("Confirm new password") %> + <%= f.input :password, autofocus: true, label: Alchemy.t("New password"), + required: true, input_html: {autocomplete: "new-password"} %> + <%= f.input :password_confirmation, label: Alchemy.t("Confirm new password"), + required: true, input_html: {autocomplete: "new-password"} %>
<%= Alchemy.t('welcome_please_identify_notice') %>
<% end %> <%= alchemy_form_for :user, url: {action: 'create'}, id: 'login', data: { turbo: false } do |f| %> - <%= f.input Devise.authentication_keys.first, autofocus: true %> - <%= f.input :password %> + <%= f.input Devise.authentication_keys.first, autofocus: true, required: true, + input_html: {autocomplete: Devise.authentication_keys.first == :email ? "email" : "username"} %> + <%= f.input :password, required: true, input_html: {autocomplete: "current-password"} %>| - | - <%= sort_link @query, :login, hide_indicator: true %> - | -- <%= sort_link @query, :firstname, hide_indicator: true %> - | -- <%= sort_link @query, :lastname, hide_indicator: true %> - | -- <%= sort_link @query, :email, hide_indicator: true %> - | -<%= Alchemy::User.human_attribute_name('language') %> | -- <%= sort_link @query, :last_sign_in_at, hide_indicator: true %> - | -<%= Alchemy::User.human_attribute_name('roles') %> | -- |
|---|
+ <%= Alchemy.t('Welcome to Alchemy') %> +
<%= Alchemy.t("Please Signup") %>
<% end %> <%= alchemy_form_for [:admin, @user] do |f| %> diff --git a/spec/controllers/admin/users_controller_spec.rb b/spec/controllers/admin/users_controller_spec.rb index 24aa22f8..bd1fee98 100644 --- a/spec/controllers/admin/users_controller_spec.rb +++ b/spec/controllers/admin/users_controller_spec.rb @@ -75,6 +75,14 @@ module Alchemy post :create, params: {user: attributes_for(:alchemy_admin_user)} end end + + context "with invalid params" do + it "re-renders form" do + post :create, params: {user: {firstname: "John"}} + expect(response).to render_template(:signup) + expect(response).to be_unprocessable + end + end end context "with send_credentials set to '1'" do @@ -151,7 +159,7 @@ module Alchemy context "with invalid user" do it "does not send an email notification" do - post :update, params: {id: user.id, user: {send_credentials: "1", email: ""}} + post :update, params: {id: user.id, user: {send_credentials: "1", login: ""}} expect(ActionMailer::Base.deliveries).to be_empty end end diff --git a/spec/dummy/bin/dev b/spec/dummy/bin/dev index 74ade166..5f91c205 100755 --- a/spec/dummy/bin/dev +++ b/spec/dummy/bin/dev @@ -1,8 +1,2 @@ -#!/usr/bin/env sh - -if ! gem list foreman -i --silent; then - echo "Installing foreman..." - gem install foreman -fi - -exec foreman start -f Procfile.dev "$@" +#!/usr/bin/env ruby +exec "./bin/rails", "server", *ARGV diff --git a/spec/dummy/bin/rubocop b/spec/dummy/bin/rubocop new file mode 100755 index 00000000..40330c0f --- /dev/null +++ b/spec/dummy/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") diff --git a/spec/dummy/bin/setup b/spec/dummy/bin/setup index ec47b79b..be3db3c0 100755 --- a/spec/dummy/bin/setup +++ b/spec/dummy/bin/setup @@ -1,11 +1,10 @@ #!/usr/bin/env ruby require "fileutils" -# path to your application root. 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 @@ -14,7 +13,6 @@ FileUtils.chdir APP_ROOT do # Add necessary setup steps to this file. puts "== Installing dependencies ==" - system! "gem install bundler --conservative" system("bundle check") || system!("bundle install") # puts "\n== Copying sample files ==" @@ -28,6 +26,9 @@ FileUtils.chdir APP_ROOT do puts "\n== Removing old logs and tempfiles ==" system! "bin/rails log:clear tmp:clear" - puts "\n== Restarting application server ==" - system! "bin/rails restart" + unless ARGV.include?("--skip-server") + puts "\n== Starting development server ==" + STDOUT.flush # flush the output before exec(2) so that it displays + exec "bin/dev" + end end diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb index d9a8450d..3facf5f8 100644 --- a/spec/dummy/config/application.rb +++ b/spec/dummy/config/application.rb @@ -3,9 +3,9 @@ require "rails" # Pick the frameworks you want: require "active_model/railtie" -# require "active_job/railtie" +require "active_job/railtie" require "active_record/railtie" -# require "active_storage/engine" +require "active_storage/engine" require "action_controller/railtie" require "action_mailer/railtie" # require "action_mailbox/engine" @@ -17,12 +17,16 @@ # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) -require "alchemy/devise" module Dummy class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults ENV.fetch("RAILS_VERSION", "7.1").to_f + config.load_defaults ENV.fetch("RAILS_VERSION", "8.0").to_f + + # 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. # diff --git a/spec/dummy/config/environments/development.rb b/spec/dummy/config/environments/development.rb index 9d3a3ee4..398747e3 100644 --- a/spec/dummy/config/environments/development.rb +++ b/spec/dummy/config/environments/development.rb @@ -3,10 +3,8 @@ Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - # In the development environment your application's code is reloaded any time - # it changes. This slows down response time but is perfect for development - # since you don't have to restart the web server when you make code changes. - config.cache_classes = false + # Make code changes take effect immediately without server restart. + config.enable_reloading = true # Do not eager load code on boot. config.eager_load = false @@ -14,59 +12,58 @@ # 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. - # Run rails dev:cache to toggle caching. + # Enable/disable Action Controller caching. By default Action Controller caching is disabled. + # Run rails dev:cache to toggle Action Controller caching. if Rails.root.join("tmp/caching-dev.txt").exist? config.action_controller.perform_caching = true 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 + # Change to :null_store to avoid any caching. + config.cache_store = :memory_store + + # 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 + # Make template changes take effect immediately. config.action_mailer.perform_caching = false + # Set localhost to be used by links generated in mailer templates. + config.action_mailer.default_url_options = { host: "localhost", port: 3000 } + # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log - # Raise exceptions for disallowed deprecations. - config.active_support.disallowed_deprecation = :raise - - # Tell Active Support which deprecation messages to disallow. - config.active_support.disallowed_deprecation_warnings = [] - # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true - # Debug mode disables concatenation and preprocessing of assets. - # This option may cause significant delays in view rendering with a large - # number of complex assets. - config.assets.debug = true + # Append comments with runtime information tags to SQL queries in logs. + config.active_record.query_log_tags_enabled = true - # Suppress logger output for asset requests. - config.assets.quiet = true + # Highlight code that enqueued background job in logs. + config.active_job.verbose_enqueue_logs = true # Raises error for missing translations. # config.i18n.raise_on_missing_translations = true # Annotate rendered view with file names. - # config.action_view.annotate_rendered_view_with_filenames = true + config.action_view.annotate_rendered_view_with_filenames = true + + # Raise error when a before_action's only/except options reference missing actions. + config.action_controller.raise_on_missing_callback_actions = true - # Uncomment if you wish to allow Action Cable access from any origin. - # config.action_cable.disable_request_forgery_protection = true + # Apply autocorrection by RuboCop to files generated by `bin/rails generate`. + # config.generators.apply_rubocop_autocorrect_after_generate! end diff --git a/spec/dummy/config/environments/production.rb b/spec/dummy/config/environments/production.rb index 63991a8e..17496077 100644 --- a/spec/dummy/config/environments/production.rb +++ b/spec/dummy/config/environments/production.rb @@ -4,82 +4,86 @@ # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. - config.cache_classes = true + config.enable_reloading = false - # Eager load code on boot. This eager loads most of Rails and - # your application in memory, allowing both threaded web servers - # and those relying on copy on write to perform better. - # Rake tasks automatically ignore this option for performance. + # Eager load code on boot for better performance and memory savings (ignored by Rake tasks). config.eager_load = true - # Full error reports are disabled and caching is turned on. - config.consider_all_requests_local = false - config.action_controller.perform_caching = true - - # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] - # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). - # config.require_master_key = true - - # Disable serving static files from the `/public` folder by default since - # Apache or NGINX already handles this. - config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? + # Full error reports are disabled. + config.consider_all_requests_local = false - # Compress CSS using a preprocessor. - # config.assets.css_compressor = :sass + # Turn on fragment caching in view templates. + config.action_controller.perform_caching = true - # Do not fallback to assets pipeline if a precompiled asset is missed. - config.assets.compile = false + # Cache assets for far-future expiry since they are all digest stamped. + config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" } # Enable serving of images, stylesheets, and JavaScripts from an asset server. # 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 + + # Assume all access to the app is happening through a SSL-terminating reverse proxy. + config.assume_ssl = true # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - # config.force_ssl = true + config.force_ssl = true - # Include generic and useful information about system operation, but avoid logging too much - # information to avoid inadvertent exposure of personally identifiable information (PII). - config.log_level = :info + # Skip http-to-https redirect for the default health check endpoint. + # config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } } - # Prepend all log lines with the following tags. + # Log to STDOUT with the current request id as a default log tag. config.log_tags = [ :request_id ] + config.logger = ActiveSupport::TaggedLogging.logger(STDOUT) - # Use a different cache store in production. - # config.cache_store = :mem_cache_store + # Change to "debug" to log everything (including potentially personally-identifiable information!) + config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info") + + # Prevent health checks from clogging up the logs. + config.silence_healthcheck_path = "/up" + + # Don't log any deprecations. + config.active_support.report_deprecations = false - # Use a real queuing backend for Active Job (and separate queues per environment). - # config.active_job.queue_adapter = :resque - # config.active_job.queue_name_prefix = "dummy_production" + # Replace the default in-process memory cache store with a durable alternative. + # config.cache_store = :mem_cache_store - config.action_mailer.perform_caching = false + # Replace the default in-process and non-durable queuing backend for Active Job. + # config.active_job.queue_adapter = :resque # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false + # Set host to be used by links generated in mailer templates. + config.action_mailer.default_url_options = { host: "example.com" } + + # Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit. + # config.action_mailer.smtp_settings = { + # user_name: Rails.application.credentials.dig(:smtp, :user_name), + # password: Rails.application.credentials.dig(:smtp, :password), + # address: "smtp.example.com", + # port: 587, + # authentication: :plain + # } + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true - # Don't log any deprecations. - config.active_support.report_deprecations = false - - # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new - - # Use a different logger for distributed setups. - # require "syslog/logger" - # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name") - - if ENV["RAILS_LOG_TO_STDOUT"].present? - logger = ActiveSupport::Logger.new(STDOUT) - logger.formatter = config.log_formatter - config.logger = ActiveSupport::TaggedLogging.new(logger) - end - # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false + + # Only use :id for inspections in production. + config.active_record.attributes_for_inspect = [ :id ] + + # Enable DNS rebinding protection and other `Host` header attacks. + # config.hosts = [ + # "example.com", # Allow requests from example.com + # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com` + # ] + # + # Skip DNS rebinding protection for the default health check endpoint. + # config.host_authorization = { exclude: ->(request) { request.path == "/up" } } end diff --git a/spec/dummy/config/environments/test.rb b/spec/dummy/config/environments/test.rb index 04f8d01f..c2095b11 100644 --- a/spec/dummy/config/environments/test.rb +++ b/spec/dummy/config/environments/test.rb @@ -1,5 +1,3 @@ -require "active_support/core_ext/integer/time" - # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped @@ -8,50 +6,48 @@ Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - # Turn false under Spring and add config.action_view.cache_template_loading = true. - config.cache_classes = true + # While tests run files are not watched, reloading is not necessary. + config.enable_reloading = false - # Eager loading loads your whole application. When running a single test locally, - # this probably isn't necessary. It's a good idea to do in a continuous integration - # system, or in some way before deploying your code. - config.eager_load = false + # Eager loading loads your entire application. When running a single test locally, + # this is usually not necessary, and can slow down your test suite. However, it's + # recommended that you enable it in continuous integration systems to ensure eager + # loading is working properly before deploying your code. + 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}" - } + # Configure public file server for tests with cache-control for performance. + config.public_file_server.headers = { "cache-control" => "public, max-age=3600" } - # Show full error reports and disable caching. - config.consider_all_requests_local = true - config.action_controller.perform_caching = false + # Show full error reports. + config.consider_all_requests_local = true config.cache_store = :null_store - # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = false + # Render exception templates for rescuable exceptions and raise for other exceptions. + config.action_dispatch.show_exceptions = :rescuable # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false - config.action_mailer.perform_caching = false + # Store uploaded files on the local file system in a temporary directory. + config.active_storage.service = :test # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test + # Set host to be used by links generated in mailer templates. + config.action_mailer.default_url_options = { host: "example.com" } + # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr - # Raise exceptions for disallowed deprecations. - config.active_support.disallowed_deprecation = :raise - - # Tell Active Support which deprecation messages to disallow. - config.active_support.disallowed_deprecation_warnings = [] - # Raises error for missing translations. # config.i18n.raise_on_missing_translations = true # 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. + config.action_controller.raise_on_missing_callback_actions = true end diff --git a/spec/dummy/config/initializers/alchemy.rb b/spec/dummy/config/initializers/alchemy.rb index cfd4ba41..b6d6199d 100644 --- a/spec/dummy/config/initializers/alchemy.rb +++ b/spec/dummy/config/initializers/alchemy.rb @@ -188,12 +188,40 @@ # # config.link_target_options = ["blank"] + # === Format matchers + # + # Named aliases for regular expressions that can be used in various places. + # The most common use case is the format validation of ingredients, or attribute validations of your individual models. + # + # == Example: + # + # validates_format_of :url, with: Alchemy.config.format_matchers.url + # + # config.format_matchers.tap do |format| + # format.email = /\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z/ + # format.url = /\A[a-z0-9]+([-.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?\z/ix + # format.link_url = /^(tel:|mailto:|\/|[a-z]+:\/\/)/ + # end + # The layout used for rendering the +alchemy/admin/pages#show+ action. # config.admin_page_preview_layout = "application" # The sizes for the preview size select in the page editor. # config.page_preview_sizes = [360, 640, 768, 1024, 1280, 1440] + # Enable full text search configuration + # + # It enables a searchable checkbox in the page form to toggle + # the searchable field. These information can used in a search + # plugin (e.g. https://github.com/AlchemyCMS/alchemy-pg_search). + # + # == Example + # + # # config/initializers/alchemy.rb + # Alchemy.config.page_searchable_checkbox = true + # + # config.show_page_searchable_checkbox = false + # The storage adapter for Pictures and Attachments # config.storage_adapter = "dragonfly" diff --git a/spec/dummy/config/initializers/assets.rb b/spec/dummy/config/initializers/assets.rb index 2eeef966..48732442 100644 --- a/spec/dummy/config/initializers/assets.rb +++ b/spec/dummy/config/initializers/assets.rb @@ -5,8 +5,3 @@ # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path - -# 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 ) diff --git a/spec/dummy/config/initializers/content_security_policy.rb b/spec/dummy/config/initializers/content_security_policy.rb index 54f47cf1..b3076b38 100644 --- a/spec/dummy/config/initializers/content_security_policy.rb +++ b/spec/dummy/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/spec/dummy/config/initializers/filter_parameter_logging.rb b/spec/dummy/config/initializers/filter_parameter_logging.rb index adc6568c..c0b717f7 100644 --- a/spec/dummy/config/initializers/filter_parameter_logging.rb +++ b/spec/dummy/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 + :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc ] diff --git a/spec/dummy/config/puma.rb b/spec/dummy/config/puma.rb index c7f311f8..a248513b 100644 --- a/spec/dummy/config/puma.rb +++ b/spec/dummy/config/puma.rb @@ -1,47 +1,41 @@ -# 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. +# 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. # -threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i -threads threads_count, threads_count - -# Specifies the `port` that Puma will listen on to receive requests, default is 3000. +# Puma starts a configurable number of processes (workers) and each process +# serves each request in a thread from an internal thread pool. # -port ENV.fetch("PORT") { 3000 } - -# Specifies the `environment` that Puma will run in. +# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You +# should only set this value when you want to run 2 or more workers. The +# default is already 1. # -environment ENV.fetch("RAILS_ENV") { "development" } - -# Specifies the number of `workers` to boot in clustered mode. -# Workers are forked webserver 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 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 +# prioritize throughput over latency. # -# workers ENV.fetch("WEB_CONCURRENCY") { 2 } - -# 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. If you use this option -# you need to make sure to reconnect any threads in the `on_worker_boot` -# block. +# 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. # -# preload_app! - -# The code in the `on_worker_boot` will be called if you are using -# clustered mode by specifying a number of `workers`. After each worker -# process is booted this block will be run, if you are using `preload_app!` -# option you will want to use this block to reconnect to any threads -# or connections that may have been created at application boot, Ruby -# cannot share connections between processes. +# The default is set to 3 threads as it's deemed a decent compromise between +# throughput and latency for the average Rails application. # -# on_worker_boot do -# ActiveRecord::Base.establish_connection if defined?(ActiveRecord) -# end +# 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 + +# 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 + +# Run the Solid Queue supervisor inside of Puma for single-server deployments +plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"] + +# 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/spec/dummy/public/400.html b/spec/dummy/public/400.html new file mode 100644 index 00000000..282dbc8c --- /dev/null +++ b/spec/dummy/public/400.html @@ -0,0 +1,114 @@ + + + + + + +The server cannot process the request due to a client error. Please check the request and try again. If you’re the application owner check the logs for more information.
+You may have mistyped the address or the page may have moved.
-If you are the application owner check the logs for more information.
- + + + + + + +The page you were looking for doesn’t exist. You may have mistyped the address or the page may have moved. If you’re the application owner check the logs for more information.
+Your browser is not supported.
Please upgrade your browser to continue.
Maybe you tried to change something you didn't have access to.
-If you are the application owner check the logs for more information.
- + + + + + + +The change you wanted was rejected. Maybe you tried to change something you didn’t have access to. If you’re the application owner check the logs for more information.
+If you are the application owner check the logs for more information.
- + + + + + + +We’re sorry, but something went wrong.
If you’re the application owner check the logs for more information.