diff --git a/Gemfile b/Gemfile
index f8967faa9..2672f7179 100644
--- a/Gemfile
+++ b/Gemfile
@@ -13,8 +13,8 @@ ruby file: '.ruby-version'
source 'https://rubygems.org'
source 'https://rubygems.org' do
- # Rails 8.0
- gem 'rails', '~> 8.0.4'
+ # Rails 8.1
+ gem 'rails', '~> 8.1.1'
# Load ENV from .env(.*) files
gem 'dotenv-rails', require: 'dotenv/load'
diff --git a/Gemfile.lock b/Gemfile.lock
index 40ececa18..05eeb65ed 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -36,6 +36,7 @@ PATH
amazing_print
aws-sdk-s3
bcrypt (~> 3.1.16)
+ benchmark
bugsnag
cloudflare-rails
devise
@@ -181,29 +182,31 @@ PATH
GEM
remote: https://rubygems.org/
specs:
- actioncable (8.0.4)
- actionpack (= 8.0.4)
- activesupport (= 8.0.4)
+ action_text-trix (2.1.15)
+ railties
+ actioncable (8.1.1)
+ actionpack (= 8.1.1)
+ activesupport (= 8.1.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
- actionmailbox (8.0.4)
- actionpack (= 8.0.4)
- activejob (= 8.0.4)
- activerecord (= 8.0.4)
- activestorage (= 8.0.4)
- activesupport (= 8.0.4)
+ actionmailbox (8.1.1)
+ actionpack (= 8.1.1)
+ activejob (= 8.1.1)
+ activerecord (= 8.1.1)
+ activestorage (= 8.1.1)
+ activesupport (= 8.1.1)
mail (>= 2.8.0)
- actionmailer (8.0.4)
- actionpack (= 8.0.4)
- actionview (= 8.0.4)
- activejob (= 8.0.4)
- activesupport (= 8.0.4)
+ actionmailer (8.1.1)
+ actionpack (= 8.1.1)
+ actionview (= 8.1.1)
+ activejob (= 8.1.1)
+ activesupport (= 8.1.1)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
- actionpack (8.0.4)
- actionview (= 8.0.4)
- activesupport (= 8.0.4)
+ actionpack (8.1.1)
+ actionview (= 8.1.1)
+ activesupport (= 8.1.1)
nokogiri (>= 1.8.5)
rack (>= 2.2.4)
rack-session (>= 1.0.1)
@@ -211,27 +214,28 @@ GEM
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
useragent (~> 0.16)
- actiontext (8.0.4)
- actionpack (= 8.0.4)
- activerecord (= 8.0.4)
- activestorage (= 8.0.4)
- activesupport (= 8.0.4)
+ actiontext (8.1.1)
+ action_text-trix (~> 2.1.15)
+ actionpack (= 8.1.1)
+ activerecord (= 8.1.1)
+ activestorage (= 8.1.1)
+ activesupport (= 8.1.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
- actionview (8.0.4)
- activesupport (= 8.0.4)
+ actionview (8.1.1)
+ activesupport (= 8.1.1)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
- activejob (8.0.4)
- activesupport (= 8.0.4)
+ activejob (8.1.1)
+ activesupport (= 8.1.1)
globalid (>= 0.3.6)
- activemodel (8.0.4)
- activesupport (= 8.0.4)
- activerecord (8.0.4)
- activemodel (= 8.0.4)
- activesupport (= 8.0.4)
+ activemodel (8.1.1)
+ activesupport (= 8.1.1)
+ activerecord (8.1.1)
+ activemodel (= 8.1.1)
+ activesupport (= 8.1.1)
timeout (>= 0.4.0)
activerecord-session_store (2.2.0)
actionpack (>= 7.0)
@@ -239,20 +243,20 @@ GEM
cgi (>= 0.3.6)
rack (>= 2.0.8, < 4)
railties (>= 7.0)
- activestorage (8.0.4)
- actionpack (= 8.0.4)
- activejob (= 8.0.4)
- activerecord (= 8.0.4)
- activesupport (= 8.0.4)
+ activestorage (8.1.1)
+ actionpack (= 8.1.1)
+ activejob (= 8.1.1)
+ activerecord (= 8.1.1)
+ activesupport (= 8.1.1)
marcel (~> 1.0)
- activesupport (8.0.4)
+ activesupport (8.1.1)
base64
- benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
+ json
logger (>= 1.4.2)
minitest (>= 5.1)
securerandom (>= 0.3)
@@ -544,7 +548,7 @@ GEM
timeout
net-smtp (0.5.1)
net-protocol
- nio4r (2.7.4)
+ nio4r (2.7.5)
nokogiri (1.18.10)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
@@ -614,20 +618,20 @@ GEM
rack (>= 1.3)
rackup (2.2.1)
rack (>= 3)
- rails (8.0.4)
- actioncable (= 8.0.4)
- actionmailbox (= 8.0.4)
- actionmailer (= 8.0.4)
- actionpack (= 8.0.4)
- actiontext (= 8.0.4)
- actionview (= 8.0.4)
- activejob (= 8.0.4)
- activemodel (= 8.0.4)
- activerecord (= 8.0.4)
- activestorage (= 8.0.4)
- activesupport (= 8.0.4)
+ rails (8.1.1)
+ actioncable (= 8.1.1)
+ actionmailbox (= 8.1.1)
+ actionmailer (= 8.1.1)
+ actionpack (= 8.1.1)
+ actiontext (= 8.1.1)
+ actionview (= 8.1.1)
+ activejob (= 8.1.1)
+ activemodel (= 8.1.1)
+ activerecord (= 8.1.1)
+ activestorage (= 8.1.1)
+ activesupport (= 8.1.1)
bundler (>= 1.15.0)
- railties (= 8.0.4)
+ railties (= 8.1.1)
rails-dom-testing (2.3.0)
activesupport (>= 5.0.0)
minitest
@@ -648,9 +652,9 @@ GEM
request_store
sassc-rails (>= 2.0.0)
turbolinks
- railties (8.0.4)
- actionpack (= 8.0.4)
- activesupport (= 8.0.4)
+ railties (8.1.1)
+ actionpack (= 8.1.1)
+ activesupport (= 8.1.1)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
@@ -917,7 +921,7 @@ DEPENDENCIES
rack (~> 3.2.4)!
rack-attack!
rack-session (~> 2.1.1)!
- rails (~> 8.0.4)!
+ rails (~> 8.1.1)!
rails-pg-extras!
rails_email_preview!
rspec-instafail!
diff --git a/bin/bundler-audit b/bin/bundler-audit
new file mode 100755
index 000000000..e2ef22690
--- /dev/null
+++ b/bin/bundler-audit
@@ -0,0 +1,6 @@
+#!/usr/bin/env ruby
+require_relative "../config/boot"
+require "bundler/audit/cli"
+
+ARGV.concat %w[ --config config/bundler-audit.yml ] if ARGV.empty? || ARGV.include?("check")
+Bundler::Audit::CLI.start
diff --git a/bin/ci b/bin/ci
new file mode 100755
index 000000000..4137ad5bb
--- /dev/null
+++ b/bin/ci
@@ -0,0 +1,6 @@
+#!/usr/bin/env ruby
+require_relative "../config/boot"
+require "active_support/continuous_integration"
+
+CI = ActiveSupport::ContinuousIntegration
+require_relative "../config/ci.rb"
diff --git a/bin/rubocop b/bin/rubocop
index 40330c0ff..5a2050471 100755
--- a/bin/rubocop
+++ b/bin/rubocop
@@ -2,7 +2,7 @@
require "rubygems"
require "bundler/setup"
-# explicit rubocop config increases performance slightly while avoiding config confusion.
+# 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/bin/setup b/bin/setup
index b31090b2a..80bdecfa7 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
@@ -14,7 +14,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 =="
@@ -24,14 +23,15 @@ FileUtils.chdir APP_ROOT do
puts "\n== Preparing database =="
system! 'bin/rails db:prepare'
+ system! 'bin/rails db:reset' if ARGV.include?( '--reset' )
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
- # 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"
+ exec 'bin/dev'
+ end
end
diff --git a/config/application.rb b/config/application.rb
index 5e9a3da5a..6199cd3c5 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -33,7 +33,12 @@ module ShinyHostApp
# Rails application class for the ShinyHostApp
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
- config.load_defaults 8.0
+ config.load_defaults 8.1
+
+ # 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 generators tasks ] )
# Configuration for the application, engines, and railties goes here.
#
@@ -43,11 +48,6 @@ class Application < Rails::Application
# config.time_zone = "Central Time (US & Canada)"
# config.eager_load_paths << Rails.root.join("extras")
- # 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 generators tasks ] )
-
# Add autoloaded paths into `$LOAD_PATH`
config.add_autoload_paths_to_load_path = true
diff --git a/config/bundler-audit.yml b/config/bundler-audit.yml
new file mode 100644
index 000000000..e74b3af94
--- /dev/null
+++ b/config/bundler-audit.yml
@@ -0,0 +1,5 @@
+# Audit all gems listed in the Gemfile for known security problems by running bin/bundler-audit.
+# CVEs that are not relevant to the application can be enumerated on the ignore list below.
+
+ignore:
+ - CVE-THAT-DOES-NOT-APPLY
diff --git a/config/ci.rb b/config/ci.rb
new file mode 100644
index 000000000..348926291
--- /dev/null
+++ b/config/ci.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+# Run using bin/ci
+
+CI.run do
+ step 'Setup', 'bin/setup --skip-server'
+
+ step 'Style: Ruby', 'bin/rubocop'
+
+ step 'Security: Gem audit", "bin/bundler-audit'
+ step 'Security: Importmap vulnerability audit", "bin/importmap audit'
+ step 'Security: Brakeman code analysis", "bin/brakeman --quiet --no-pager --exit-on-warn --exit-on-error'
+
+ # Optional: set a green GitHub commit status to unblock PR merge.
+ # Requires the `gh` CLI and `gh extension install basecamp/gh-signoff`.
+ # if success?
+ # step "Signoff: All systems go. Ready for merge and deploy.", "gh signoff"
+ # else
+ # failure "Signoff: CI failed. Do not merge or deploy.", "Fix the issues and try again."
+ # end
+end
diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb
index 42751dd88..74b18c5a1 100644
--- a/config/initializers/content_security_policy.rb
+++ b/config/initializers/content_security_policy.rb
@@ -18,10 +18,14 @@
# # policy.report_uri "/csp-violation-report-endpoint"
# end
#
-# # Generate session nonces for permitted importmap, inline scripts, and inline styles
+# # 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 style-src)
#
+# # Automatically add `nonce` to `javascript_tag`, `javascript_include_tag`, and `stylesheet_link_tag`
+# # if the corresponding directives are specified in `content_security_policy_nonce_directives`.
+# # config.content_security_policy_nonce_auto = true
+#
# # Report violations without enforcing the policy.
# # config.content_security_policy_report_only = true
# end
diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb
index 3babc73f0..d7a5ef02e 100644
--- a/config/initializers/filter_parameter_logging.rb
+++ b/config/initializers/filter_parameter_logging.rb
@@ -4,5 +4,5 @@
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += %i[
- passw secret token _key crypt salt certificate otp ssn
+ passw secret token _key crypt salt certificate otp ssn cvn cvc
]
diff --git a/config/puma.rb b/config/puma.rb
index ea6cfc07a..5ac9f963d 100644
--- a/config/puma.rb
+++ b/config/puma.rb
@@ -1,24 +1,10 @@
# frozen_string_literal: true
-# 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
-
# Specifies the `worker_timeout` threshold that Puma will use to wait before
# terminating a worker in development environments.
#
worker_timeout 3600 if ENV.fetch( 'RAILS_ENV', 'development' ) == 'development'
-# Specifies the `port` Puma will listen on to receive requests; default is 3000
-#
-port ENV.fetch( 'PORT', 3000 )
-
# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch( 'RAILS_ENV', 'development' )
@@ -41,7 +27,20 @@
#
# preload_app!
-# Allow puma to be restarted by `rails restart` command.
+# 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
+
+# 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 `bin/rails restart` command.
plugin :tmp_restart
# Specify the PID file. Defaults to tmp/pids/server.pid in development.
diff --git a/plugins/ShinyCMS/shinycms.gemspec b/plugins/ShinyCMS/shinycms.gemspec
index 1e8a7d867..ca9594da3 100644
--- a/plugins/ShinyCMS/shinycms.gemspec
+++ b/plugins/ShinyCMS/shinycms.gemspec
@@ -124,12 +124,15 @@ Gem::Specification.new do |spec|
# Fix request.ip when running behind Cloudflare proxying
spec.add_dependency 'cloudflare-rails'
+ # Used to export demo site data from the database
+ spec.add_dependency 'seed_dump'
+
# Must be explicitly required from Rails 7.2 onwards
spec.add_dependency 'mutex_m'
spec.add_dependency 'ostruct'
- # Used to export demo site data from the database
- spec.add_dependency 'seed_dump'
+ # Must be explicitly required from Rails 8.2 onwards (warns from 8.1)
+ spec.add_dependency 'benchmark'
# Test coverage
spec.add_development_dependency 'simplecov'
diff --git a/public/400.html b/public/400.html
index 282dbc8cc..640de0339 100644
--- a/public/400.html
+++ b/public/400.html
@@ -35,12 +35,35 @@
font-weight: 400;
letter-spacing: -0.0025em;
line-height: 1.4;
- min-height: 100vh;
+ min-height: 100dvh;
place-items: center;
text-rendering: optimizeLegibility;
-webkit-text-size-adjust: 100%;
}
+ #error-description {
+ fill: #d30001;
+ }
+
+ #error-id {
+ fill: #f0eff0;
+ }
+
+ @media (prefers-color-scheme: dark) {
+ body {
+ background: #101010;
+ color: #e0e0e0;
+ }
+
+ #error-description {
+ fill: #FF6161;
+ }
+
+ #error-id {
+ fill: #2c2c2c;
+ }
+ }
+
a {
color: inherit;
font-weight: 700;
@@ -83,13 +106,11 @@
}
main article br {
-
display: none;
@media(min-width: 48em) {
display: inline;
}
-
}
@@ -102,10 +123,10 @@
-
+
-
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.
+
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.
- 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.
-
-
If you are the application owner check the logs for more information.
-
-
+
+
+
+
+
+
+ The page you were looking for doesn't exist (404 Not found)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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.
+
+
+
+
+
diff --git a/public/406-unsupported-browser.html b/public/406-unsupported-browser.html
index 7cf1e168e..43d2811e8 100644
--- a/public/406-unsupported-browser.html
+++ b/public/406-unsupported-browser.html
@@ -1,66 +1,135 @@
-
-
-
- Your browser is not supported (406)
-
-
-
-
-
-
-
-
-
Your browser is not supported.
-
Please upgrade your browser to continue.
-
-
-
+
+
+
+
+
+
+ Your browser is not supported (406 Not Acceptable)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Your browser is not supported. Please upgrade your browser to continue.
+
+
+
+
+
diff --git a/public/422.html b/public/422.html
index c08eac0d1..f12fb4aa1 100644
--- a/public/422.html
+++ b/public/422.html
@@ -1,67 +1,135 @@
-
-
-
- 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.
-
-
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.