Files
grecia/config/initializers/active_storage_message_rotator.rb
Javi Martín 8d1a848e60 Remove code to rotate non-SHA256 cookies
This code was added in commit b3f570512 in order to rotate existing
cookies used by Consul Democracy 2.1 and earlier. Since the code was
included in Consul Democracy 2.2, existing installation using Consul
Democracy 2.2 will have already rotated the old cookies, which means we
don't need the cookie rotator anymore.
2025-01-08 16:47:57 +01:00

13 lines
607 B
Ruby

# This code was copied from:
# https://github.com/hotwired/turbo-rails/blob/v1.4.0/UPGRADING.md#key-digest-changes-in-111
# Removing this code will make ActiveStorage image URLs generated with Rails 6.1
# or earlier inaccessible, causing images attached with CKEditor or linked from
# somewhere else not to be rendered.
Rails.application.config.after_initialize do |app|
key_generator = ActiveSupport::KeyGenerator.new(
app.secret_key_base, iterations: 1000, hash_digest_class: OpenSSL::Digest::SHA1
)
app.message_verifier("ActiveStorage").rotate(key_generator.generate_key("ActiveStorage"))
end