active_storage_encryption 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Appraisals +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +236 -0
- data/Rakefile +17 -0
- data/bin/rails +26 -0
- data/bin/rubocop +8 -0
- data/config/initializers/active_storage_encryption.rb +9 -0
- data/config/routes.rb +7 -0
- data/gemfiles/rails_7.gemfile +7 -0
- data/gemfiles/rails_7.gemfile.lock +276 -0
- data/gemfiles/rails_8.gemfile +7 -0
- data/gemfiles/rails_8.gemfile.lock +276 -0
- data/lib/active_storage/service/encrypted_disk_service.rb +10 -0
- data/lib/active_storage/service/encrypted_mirror_service.rb +10 -0
- data/lib/active_storage/service/encrypted_s3_service.rb +10 -0
- data/lib/active_storage_encryption/encrypted_blobs_controller.rb +163 -0
- data/lib/active_storage_encryption/encrypted_disk_service/v1_scheme.rb +28 -0
- data/lib/active_storage_encryption/encrypted_disk_service/v2_scheme.rb +51 -0
- data/lib/active_storage_encryption/encrypted_disk_service.rb +186 -0
- data/lib/active_storage_encryption/encrypted_mirror_service.rb +76 -0
- data/lib/active_storage_encryption/encrypted_s3_service.rb +236 -0
- data/lib/active_storage_encryption/engine.rb +7 -0
- data/lib/active_storage_encryption/overrides.rb +201 -0
- data/lib/active_storage_encryption/private_url_policy.rb +53 -0
- data/lib/active_storage_encryption/resumable_gcs_upload.rb +194 -0
- data/lib/active_storage_encryption/version.rb +5 -0
- data/lib/active_storage_encryption.rb +79 -0
- data/lib/tasks/active_storage_encryption_tasks.rake +6 -0
- data/test/active_storage_encryption_test.rb +9 -0
- data/test/dummy/Rakefile +8 -0
- data/test/dummy/app/assets/stylesheets/application.css +1 -0
- data/test/dummy/app/controllers/application_controller.rb +6 -0
- data/test/dummy/app/helpers/application_helper.rb +4 -0
- data/test/dummy/app/models/application_record.rb +5 -0
- data/test/dummy/app/views/layouts/application.html.erb +22 -0
- data/test/dummy/app/views/pwa/manifest.json.erb +22 -0
- data/test/dummy/app/views/pwa/service-worker.js +26 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +37 -0
- data/test/dummy/config/application.rb +43 -0
- data/test/dummy/config/boot.rb +7 -0
- data/test/dummy/config/credentials.yml.enc +1 -0
- data/test/dummy/config/database.yml +32 -0
- data/test/dummy/config/environment.rb +7 -0
- data/test/dummy/config/environments/development.rb +59 -0
- data/test/dummy/config/environments/production.rb +81 -0
- data/test/dummy/config/environments/test.rb +53 -0
- data/test/dummy/config/initializers/content_security_policy.rb +27 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +10 -0
- data/test/dummy/config/initializers/inflections.rb +18 -0
- data/test/dummy/config/initializers/permissions_policy.rb +15 -0
- data/test/dummy/config/locales/en.yml +31 -0
- data/test/dummy/config/master.key +1 -0
- data/test/dummy/config/puma.rb +36 -0
- data/test/dummy/config/routes.rb +5 -0
- data/test/dummy/config/storage.yml +21 -0
- data/test/dummy/config.ru +8 -0
- data/test/dummy/db/migrate/20250304023851_create_active_storage_tables.active_storage.rb +60 -0
- data/test/dummy/db/migrate/20250304023853_add_blob_encryption_key_column.rb +7 -0
- data/test/dummy/db/schema.rb +47 -0
- data/test/dummy/log/test.log +1022 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/406-unsupported-browser.html +66 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/icon.png +0 -0
- data/test/dummy/public/icon.svg +3 -0
- data/test/dummy/storage/test.sqlite3 +0 -0
- data/test/dummy/storage/x6/pl/x6plznfuhrsyjn9pox2a6xgmcs3x +0 -0
- data/test/dummy/storage/yq/sv/yqsvw5a72b3fv719zq8a6yb7lv0j +0 -0
- data/test/integration/encrypted_blobs_controller_test.rb +400 -0
- data/test/lib/encrypted_disk_service_test.rb +387 -0
- data/test/lib/encrypted_mirror_service_test.rb +159 -0
- data/test/lib/encrypted_s3_service_test.rb +293 -0
- data/test/test_helper.rb +19 -0
- metadata +264 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "fileutils"
|
3
|
+
|
4
|
+
APP_ROOT = File.expand_path("..", __dir__)
|
5
|
+
APP_NAME = "dummy"
|
6
|
+
|
7
|
+
def system!(*args)
|
8
|
+
system(*args, exception: true)
|
9
|
+
end
|
10
|
+
|
11
|
+
FileUtils.chdir APP_ROOT do
|
12
|
+
# This script is a way to set up or update your development environment automatically.
|
13
|
+
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
14
|
+
# Add necessary setup steps to this file.
|
15
|
+
|
16
|
+
puts "== Installing dependencies =="
|
17
|
+
system! "gem install bundler --conservative"
|
18
|
+
system("bundle check") || system!("bundle install")
|
19
|
+
|
20
|
+
# puts "\n== Copying sample files =="
|
21
|
+
# unless File.exist?("config/database.yml")
|
22
|
+
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
|
23
|
+
# end
|
24
|
+
|
25
|
+
puts "\n== Preparing database =="
|
26
|
+
system! "bin/rails db:prepare"
|
27
|
+
|
28
|
+
puts "\n== Removing old logs and tempfiles =="
|
29
|
+
system! "bin/rails log:clear tmp:clear"
|
30
|
+
|
31
|
+
puts "\n== Restarting application server =="
|
32
|
+
system! "bin/rails restart"
|
33
|
+
|
34
|
+
# puts "\n== Configuring puma-dev =="
|
35
|
+
# system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}"
|
36
|
+
# system "curl -Is https://#{APP_NAME}.test/up | head -n 1"
|
37
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "boot"
|
4
|
+
|
5
|
+
require "rails"
|
6
|
+
# Pick the frameworks you want:
|
7
|
+
require "active_model/railtie"
|
8
|
+
# require "active_job/railtie"
|
9
|
+
require "active_record/railtie"
|
10
|
+
require "active_storage/engine"
|
11
|
+
require "action_controller/railtie"
|
12
|
+
# require "action_mailer/railtie"
|
13
|
+
# require "action_mailbox/engine"
|
14
|
+
# require "action_text/engine"
|
15
|
+
# require "action_view/railtie"
|
16
|
+
# require "action_cable/engine"
|
17
|
+
require "rails/test_unit/railtie"
|
18
|
+
|
19
|
+
# Require the gems listed in Gemfile, including any gems
|
20
|
+
# you've limited to :test, :development, or :production.
|
21
|
+
Bundler.require(*Rails.groups)
|
22
|
+
|
23
|
+
module Dummy
|
24
|
+
class Application < Rails::Application
|
25
|
+
config.load_defaults Rails::VERSION::STRING.to_f
|
26
|
+
|
27
|
+
# For compatibility with applications that use this config
|
28
|
+
config.action_controller.include_all_helpers = false
|
29
|
+
|
30
|
+
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
31
|
+
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
32
|
+
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
33
|
+
config.autoload_lib(ignore: %w[assets tasks])
|
34
|
+
|
35
|
+
# Configuration for the application, engines, and railties goes here.
|
36
|
+
#
|
37
|
+
# These settings can be overridden in specific environments using the files
|
38
|
+
# in config/environments, which are processed later.
|
39
|
+
#
|
40
|
+
# config.time_zone = "Central Time (US & Canada)"
|
41
|
+
# config.eager_load_paths << Rails.root.join("extras")
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Set up gems listed in the Gemfile.
|
4
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__)
|
5
|
+
|
6
|
+
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
|
7
|
+
$LOAD_PATH.unshift File.expand_path("../../../lib", __dir__)
|
@@ -0,0 +1 @@
|
|
1
|
+
2l6uOM8Eocu/ZzELRAuQAW063JqYqj5SEFAkkDNOHIjF4GVv7oArN63UEga8QUMs1ac6Qvj/Smlpx6S+Kr32Zww+fCVHdZ95mSA41+W5C/uX1hVaWpTL3ndcIJL3VgkQ90gpPKr8eIeeTW+CEcXrxSlAfypDp1ULJQ1F+/qXYUOyXGln7Zzcg/GQHGYQyA2hQHAHAb3YtQ47yc3eBwrBV5M4/PL9fOAWZ0t3sGWCjShaPDMYoKTy75tuAZrV7EzxWzGJbRBGL0710oWA3VvmoEZE6MScOJqII2Rla+iwcFmXmkXbHhXZvJ5465Wk+4mWwBx9vm9OL0BtBxKrAKK0z73pP0RStlSge11pojcoS38evvEIL96r1IL32RfKReRA6uaT5mECUrWNpGsORTayXAfjeR6hwGhh1UXAu2yIEPn2VFTBWnS2knP5KoCf/oyBQ2RY9IqIyOIjRRUzlqThS0Xj9LvqXQSS5giFJRxLZs4YL3zYhsQl31aaIMtG4bWF3mVDSp/Bv6Y7rVqVFRZWB+vN9JGxtlGWcwfCAFazgzSlN7SYHGg0KecCLARlcAsaaX/Ll15YTDmexOZqoSNCMQac2sDUmcD2WQs2UrNVjoSpSsGjRUtV1RmpUu0/DPCioBbmP5ekB1QziI608w==--fldX094wtj6HqTmD--YacYv9MBtmejAYn9+oIBYg==
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# SQLite. Versions 3.8.0 and up are supported.
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem "sqlite3"
|
6
|
+
#
|
7
|
+
default: &default
|
8
|
+
adapter: sqlite3
|
9
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
development:
|
13
|
+
<<: *default
|
14
|
+
database: storage/development.sqlite3
|
15
|
+
|
16
|
+
# Warning: The database defined as "test" will be erased and
|
17
|
+
# re-generated from your development database when you run "rake".
|
18
|
+
# Do not set this db to the same as development or production.
|
19
|
+
test:
|
20
|
+
<<: *default
|
21
|
+
database: storage/test.sqlite3
|
22
|
+
|
23
|
+
|
24
|
+
# SQLite3 write its data on the local filesystem, as such it requires
|
25
|
+
# persistent disks. If you are deploying to a managed service, you should
|
26
|
+
# make sure it provides disk persistence, as many don't.
|
27
|
+
#
|
28
|
+
# Similarly, if you deploy your application as a Docker container, you must
|
29
|
+
# ensure the database is located in a persisted volume.
|
30
|
+
production:
|
31
|
+
<<: *default
|
32
|
+
# database: path/to/persistent/storage/production.sqlite3
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/core_ext/integer/time"
|
4
|
+
|
5
|
+
Rails.application.configure do
|
6
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
7
|
+
|
8
|
+
# In the development environment your application's code is reloaded any time
|
9
|
+
# it changes. This slows down response time but is perfect for development
|
10
|
+
# since you don't have to restart the web server when you make code changes.
|
11
|
+
config.enable_reloading = true
|
12
|
+
|
13
|
+
# Do not eager load code on boot.
|
14
|
+
config.eager_load = false
|
15
|
+
|
16
|
+
# Show full error reports.
|
17
|
+
config.consider_all_requests_local = true
|
18
|
+
|
19
|
+
# Enable server timing.
|
20
|
+
config.server_timing = true
|
21
|
+
|
22
|
+
# Enable/disable caching. By default caching is disabled.
|
23
|
+
# Run rails dev:cache to toggle caching.
|
24
|
+
if Rails.root.join("tmp/caching-dev.txt").exist?
|
25
|
+
config.action_controller.perform_caching = true
|
26
|
+
config.action_controller.enable_fragment_cache_logging = true
|
27
|
+
|
28
|
+
config.cache_store = :memory_store
|
29
|
+
config.public_file_server.headers = {"Cache-Control" => "public, max-age=#{2.days.to_i}"}
|
30
|
+
else
|
31
|
+
config.action_controller.perform_caching = false
|
32
|
+
|
33
|
+
config.cache_store = :null_store
|
34
|
+
end
|
35
|
+
|
36
|
+
# Print deprecation notices to the Rails logger.
|
37
|
+
config.active_support.deprecation = :log
|
38
|
+
|
39
|
+
# Raise exceptions for disallowed deprecations.
|
40
|
+
config.active_support.disallowed_deprecation = :raise
|
41
|
+
|
42
|
+
# Tell Active Support which deprecation messages to disallow.
|
43
|
+
config.active_support.disallowed_deprecation_warnings = []
|
44
|
+
|
45
|
+
# Raise an error on page load if there are pending migrations.
|
46
|
+
config.active_record.migration_error = :page_load
|
47
|
+
|
48
|
+
# Highlight code that triggered database queries in logs.
|
49
|
+
config.active_record.verbose_query_logs = true
|
50
|
+
|
51
|
+
# Raises error for missing translations.
|
52
|
+
# config.i18n.raise_on_missing_translations = true
|
53
|
+
|
54
|
+
# Annotate rendered view with file names.
|
55
|
+
config.action_view.annotate_rendered_view_with_filenames = true
|
56
|
+
|
57
|
+
# Raise error when a before_action's only/except options reference missing actions.
|
58
|
+
config.action_controller.raise_on_missing_callback_actions = true
|
59
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/core_ext/integer/time"
|
4
|
+
|
5
|
+
Rails.application.configure do
|
6
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
7
|
+
|
8
|
+
# Code is not reloaded between requests.
|
9
|
+
config.enable_reloading = false
|
10
|
+
|
11
|
+
# Eager load code on boot. This eager loads most of Rails and
|
12
|
+
# your application in memory, allowing both threaded web servers
|
13
|
+
# and those relying on copy on write to perform better.
|
14
|
+
# Rake tasks automatically ignore this option for performance.
|
15
|
+
config.eager_load = true
|
16
|
+
|
17
|
+
# Full error reports are disabled and caching is turned on.
|
18
|
+
config.consider_all_requests_local = false
|
19
|
+
config.action_controller.perform_caching = true
|
20
|
+
|
21
|
+
# Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
|
22
|
+
# key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
|
23
|
+
# config.require_master_key = true
|
24
|
+
|
25
|
+
# Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
|
26
|
+
# config.public_file_server.enabled = false
|
27
|
+
|
28
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
29
|
+
# config.asset_host = "http://assets.example.com"
|
30
|
+
|
31
|
+
# Specifies the header that your server uses for sending files.
|
32
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
|
33
|
+
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
|
34
|
+
|
35
|
+
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
|
36
|
+
# Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
|
37
|
+
# config.assume_ssl = true
|
38
|
+
|
39
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
40
|
+
config.force_ssl = true
|
41
|
+
|
42
|
+
# Skip http-to-https redirect for the default health check endpoint.
|
43
|
+
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
|
44
|
+
|
45
|
+
# Log to STDOUT by default
|
46
|
+
config.logger = ActiveSupport::Logger.new($stdout)
|
47
|
+
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
|
48
|
+
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
|
49
|
+
|
50
|
+
# Prepend all log lines with the following tags.
|
51
|
+
config.log_tags = [:request_id]
|
52
|
+
|
53
|
+
# "info" includes generic and useful information about system operation, but avoids logging too much
|
54
|
+
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
|
55
|
+
# want to log everything, set the level to "debug".
|
56
|
+
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
|
57
|
+
|
58
|
+
# Use a different cache store in production.
|
59
|
+
# config.cache_store = :mem_cache_store
|
60
|
+
|
61
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
62
|
+
# the I18n.default_locale when a translation cannot be found).
|
63
|
+
config.i18n.fallbacks = true
|
64
|
+
|
65
|
+
# Don't log any deprecations.
|
66
|
+
config.active_support.report_deprecations = false
|
67
|
+
|
68
|
+
# Do not dump schema after migrations.
|
69
|
+
config.active_record.dump_schema_after_migration = false
|
70
|
+
|
71
|
+
# Only use :id for inspections in production.
|
72
|
+
config.active_record.attributes_for_inspect = [:id]
|
73
|
+
|
74
|
+
# Enable DNS rebinding protection and other `Host` header attacks.
|
75
|
+
# config.hosts = [
|
76
|
+
# "example.com", # Allow requests from example.com
|
77
|
+
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
78
|
+
# ]
|
79
|
+
# Skip DNS rebinding protection for the default health check endpoint.
|
80
|
+
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
|
81
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/core_ext/integer/time"
|
4
|
+
|
5
|
+
# The test environment is used exclusively to run your application's
|
6
|
+
# test suite. You never need to work with it otherwise. Remember that
|
7
|
+
# your test database is "scratch space" for the test suite and is wiped
|
8
|
+
# and recreated between test runs. Don't rely on the data there!
|
9
|
+
|
10
|
+
Rails.application.configure do
|
11
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
12
|
+
|
13
|
+
# While tests run files are not watched, reloading is not necessary.
|
14
|
+
config.enable_reloading = false
|
15
|
+
|
16
|
+
# Eager loading loads your entire application. When running a single test locally,
|
17
|
+
# this is usually not necessary, and can slow down your test suite. However, it's
|
18
|
+
# recommended that you enable it in continuous integration systems to ensure eager
|
19
|
+
# loading is working properly before deploying your code.
|
20
|
+
config.eager_load = ENV["CI"].present?
|
21
|
+
|
22
|
+
# Configure public file server for tests with Cache-Control for performance.
|
23
|
+
config.public_file_server.headers = {"Cache-Control" => "public, max-age=#{1.hour.to_i}"}
|
24
|
+
|
25
|
+
# Show full error reports and disable caching.
|
26
|
+
config.consider_all_requests_local = true
|
27
|
+
config.action_controller.perform_caching = false
|
28
|
+
config.cache_store = :null_store
|
29
|
+
|
30
|
+
# Render exception templates for rescuable exceptions and raise for other exceptions.
|
31
|
+
config.action_dispatch.show_exceptions = :rescuable
|
32
|
+
|
33
|
+
# Disable request forgery protection in test environment.
|
34
|
+
config.action_controller.allow_forgery_protection = false
|
35
|
+
|
36
|
+
# Print deprecation notices to the stderr.
|
37
|
+
config.active_support.deprecation = :stderr
|
38
|
+
|
39
|
+
# Raise exceptions for disallowed deprecations.
|
40
|
+
config.active_support.disallowed_deprecation = :raise
|
41
|
+
|
42
|
+
# Tell Active Support which deprecation messages to disallow.
|
43
|
+
config.active_support.disallowed_deprecation_warnings = []
|
44
|
+
|
45
|
+
# Raises error for missing translations.
|
46
|
+
# config.i18n.raise_on_missing_translations = true
|
47
|
+
|
48
|
+
# Annotate rendered view with file names.
|
49
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
50
|
+
|
51
|
+
# Raise error when a before_action's only/except options reference missing actions.
|
52
|
+
config.action_controller.raise_on_missing_callback_actions = true
|
53
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Be sure to restart your server when you modify this file.
|
4
|
+
|
5
|
+
# Define an application-wide content security policy.
|
6
|
+
# See the Securing Rails Applications Guide for more information:
|
7
|
+
# https://guides.rubyonrails.org/security.html#content-security-policy-header
|
8
|
+
|
9
|
+
# Rails.application.configure do
|
10
|
+
# config.content_security_policy do |policy|
|
11
|
+
# policy.default_src :self, :https
|
12
|
+
# policy.font_src :self, :https, :data
|
13
|
+
# policy.img_src :self, :https, :data
|
14
|
+
# policy.object_src :none
|
15
|
+
# policy.script_src :self, :https
|
16
|
+
# policy.style_src :self, :https
|
17
|
+
# # Specify URI for violation reports
|
18
|
+
# # policy.report_uri "/csp-violation-report-endpoint"
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
|
22
|
+
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
23
|
+
# config.content_security_policy_nonce_directives = %w(script-src style-src)
|
24
|
+
#
|
25
|
+
# # Report violations without enforcing the policy.
|
26
|
+
# # config.content_security_policy_report_only = true
|
27
|
+
# end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Be sure to restart your server when you modify this file.
|
4
|
+
|
5
|
+
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
|
6
|
+
# Use this to limit dissemination of sensitive information.
|
7
|
+
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
|
8
|
+
Rails.application.config.filter_parameters += [
|
9
|
+
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
|
10
|
+
]
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Be sure to restart your server when you modify this file.
|
4
|
+
|
5
|
+
# Add new inflection rules using the following format. Inflections
|
6
|
+
# are locale specific, and you may define rules for as many different
|
7
|
+
# locales as you wish. All of these examples are active by default:
|
8
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
9
|
+
# inflect.plural /^(ox)$/i, "\\1en"
|
10
|
+
# inflect.singular /^(ox)en/i, "\\1"
|
11
|
+
# inflect.irregular "person", "people"
|
12
|
+
# inflect.uncountable %w( fish sheep )
|
13
|
+
# end
|
14
|
+
|
15
|
+
# These inflection rules are supported but not enabled by default:
|
16
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
17
|
+
# inflect.acronym "RESTful"
|
18
|
+
# end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Be sure to restart your server when you modify this file.
|
4
|
+
|
5
|
+
# Define an application-wide HTTP permissions policy. For further
|
6
|
+
# information see: https://developers.google.com/web/updates/2018/06/feature-policy
|
7
|
+
|
8
|
+
# Rails.application.config.permissions_policy do |policy|
|
9
|
+
# policy.camera :none
|
10
|
+
# policy.gyroscope :none
|
11
|
+
# policy.microphone :none
|
12
|
+
# policy.usb :none
|
13
|
+
# policy.fullscreen :self
|
14
|
+
# policy.payment :self, "https://secure.example.com"
|
15
|
+
# end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization and
|
2
|
+
# are automatically loaded by Rails. If you want to use locales other than
|
3
|
+
# English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t "hello"
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t("hello") %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# To learn more about the API, please read the Rails Internationalization guide
|
20
|
+
# at https://guides.rubyonrails.org/i18n.html.
|
21
|
+
#
|
22
|
+
# Be aware that YAML interprets the following case-insensitive strings as
|
23
|
+
# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
|
24
|
+
# must be quoted to be interpreted as strings. For example:
|
25
|
+
#
|
26
|
+
# en:
|
27
|
+
# "yes": yup
|
28
|
+
# enabled: "ON"
|
29
|
+
|
30
|
+
en:
|
31
|
+
hello: "Hello world"
|
@@ -0,0 +1 @@
|
|
1
|
+
4b99c805920481b14131c91433d0d985
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This configuration file will be evaluated by Puma. The top-level methods that
|
4
|
+
# are invoked here are part of Puma's configuration DSL. For more information
|
5
|
+
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
|
6
|
+
|
7
|
+
# Puma starts a configurable number of processes (workers) and each process
|
8
|
+
# serves each request in a thread from an internal thread pool.
|
9
|
+
#
|
10
|
+
# The ideal number of threads per worker depends both on how much time the
|
11
|
+
# application spends waiting for IO operations and on how much you wish to
|
12
|
+
# to prioritize throughput over latency.
|
13
|
+
#
|
14
|
+
# As a rule of thumb, increasing the number of threads will increase how much
|
15
|
+
# traffic a given process can handle (throughput), but due to CRuby's
|
16
|
+
# Global VM Lock (GVL) it has diminishing returns and will degrade the
|
17
|
+
# response time (latency) of the application.
|
18
|
+
#
|
19
|
+
# The default is set to 3 threads as it's deemed a decent compromise between
|
20
|
+
# throughput and latency for the average Rails application.
|
21
|
+
#
|
22
|
+
# Any libraries that use a connection pool or another resource pool should
|
23
|
+
# be configured to provide at least as many connections as the number of
|
24
|
+
# threads. This includes Active Record's `pool` parameter in `database.yml`.
|
25
|
+
threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
|
26
|
+
threads threads_count, threads_count
|
27
|
+
|
28
|
+
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
29
|
+
port ENV.fetch("PORT", 3000)
|
30
|
+
|
31
|
+
# Allow puma to be restarted by `bin/rails restart` command.
|
32
|
+
plugin :tmp_restart
|
33
|
+
|
34
|
+
# Specify the PID file. Defaults to tmp/pids/server.pid in development.
|
35
|
+
# In other environments, only set the PID file if requested.
|
36
|
+
pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
|
@@ -0,0 +1,21 @@
|
|
1
|
+
development:
|
2
|
+
public: true
|
3
|
+
service: Disk
|
4
|
+
root: <%= Rails.root.join("storage") %>
|
5
|
+
|
6
|
+
test:
|
7
|
+
public: true
|
8
|
+
service: Disk
|
9
|
+
root: <%= Rails.root.join("storage") %>
|
10
|
+
|
11
|
+
encrypted_disk:
|
12
|
+
service: EncryptedDisk
|
13
|
+
root: <%= Rails.root.join("storage") %>
|
14
|
+
private_url_policy: stream
|
15
|
+
|
16
|
+
encrypted_mirror:
|
17
|
+
service: EncryptedMirror
|
18
|
+
primary:
|
19
|
+
- encrypted_disk
|
20
|
+
mirrors:
|
21
|
+
- test
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This migration comes from active_storage (originally 20170806125915)
|
4
|
+
class CreateActiveStorageTables < ActiveRecord::Migration[7.0]
|
5
|
+
def change
|
6
|
+
# Use Active Record's configured type for primary and foreign keys
|
7
|
+
primary_key_type, foreign_key_type = primary_and_foreign_key_types
|
8
|
+
|
9
|
+
create_table :active_storage_blobs, id: primary_key_type do |t|
|
10
|
+
t.string :key, null: false
|
11
|
+
t.string :filename, null: false
|
12
|
+
t.string :content_type
|
13
|
+
t.text :metadata
|
14
|
+
t.string :service_name, null: false
|
15
|
+
t.bigint :byte_size, null: false
|
16
|
+
t.string :checksum
|
17
|
+
|
18
|
+
if connection.supports_datetime_with_precision?
|
19
|
+
t.datetime :created_at, precision: 6, null: false
|
20
|
+
else
|
21
|
+
t.datetime :created_at, null: false
|
22
|
+
end
|
23
|
+
|
24
|
+
t.index [:key], unique: true
|
25
|
+
end
|
26
|
+
|
27
|
+
create_table :active_storage_attachments, id: primary_key_type do |t|
|
28
|
+
t.string :name, null: false
|
29
|
+
t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type
|
30
|
+
t.references :blob, null: false, type: foreign_key_type
|
31
|
+
|
32
|
+
if connection.supports_datetime_with_precision?
|
33
|
+
t.datetime :created_at, precision: 6, null: false
|
34
|
+
else
|
35
|
+
t.datetime :created_at, null: false
|
36
|
+
end
|
37
|
+
|
38
|
+
t.index [:record_type, :record_id, :name, :blob_id], name: :index_active_storage_attachments_uniqueness, unique: true
|
39
|
+
t.foreign_key :active_storage_blobs, column: :blob_id
|
40
|
+
end
|
41
|
+
|
42
|
+
create_table :active_storage_variant_records, id: primary_key_type do |t|
|
43
|
+
t.belongs_to :blob, null: false, index: false, type: foreign_key_type
|
44
|
+
t.string :variation_digest, null: false
|
45
|
+
|
46
|
+
t.index [:blob_id, :variation_digest], name: :index_active_storage_variant_records_uniqueness, unique: true
|
47
|
+
t.foreign_key :active_storage_blobs, column: :blob_id
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def primary_and_foreign_key_types
|
54
|
+
config = Rails.configuration.generators
|
55
|
+
setting = config.options[config.orm][:primary_key_type]
|
56
|
+
primary_key_type = setting || :primary_key
|
57
|
+
foreign_key_type = setting || :bigint
|
58
|
+
[primary_key_type, foreign_key_type]
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file is auto-generated from the current state of the database. Instead
|
4
|
+
# of editing this file, please use the migrations feature of Active Record to
|
5
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
6
|
+
#
|
7
|
+
# This file is the source Rails uses to define your schema when running `bin/rails
|
8
|
+
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
9
|
+
# be faster and is potentially less error prone than running all of your
|
10
|
+
# migrations from scratch. Old migrations may fail to apply correctly if those
|
11
|
+
# migrations use external dependencies or application code.
|
12
|
+
#
|
13
|
+
# It's strongly recommended that you check this file into your version control system.
|
14
|
+
|
15
|
+
ActiveRecord::Schema[7.2].define(version: 2025_03_04_023853) do
|
16
|
+
create_table "active_storage_attachments", force: :cascade do |t|
|
17
|
+
t.string "name", null: false
|
18
|
+
t.string "record_type", null: false
|
19
|
+
t.bigint "record_id", null: false
|
20
|
+
t.bigint "blob_id", null: false
|
21
|
+
t.datetime "created_at", null: false
|
22
|
+
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
|
23
|
+
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
|
24
|
+
end
|
25
|
+
|
26
|
+
create_table "active_storage_blobs", force: :cascade do |t|
|
27
|
+
t.string "key", null: false
|
28
|
+
t.string "filename", null: false
|
29
|
+
t.string "content_type"
|
30
|
+
t.text "metadata"
|
31
|
+
t.string "service_name", null: false
|
32
|
+
t.bigint "byte_size", null: false
|
33
|
+
t.string "checksum"
|
34
|
+
t.datetime "created_at", null: false
|
35
|
+
t.string "encryption_key"
|
36
|
+
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
|
37
|
+
end
|
38
|
+
|
39
|
+
create_table "active_storage_variant_records", force: :cascade do |t|
|
40
|
+
t.bigint "blob_id", null: false
|
41
|
+
t.string "variation_digest", null: false
|
42
|
+
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
|
43
|
+
end
|
44
|
+
|
45
|
+
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
46
|
+
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
47
|
+
end
|