Module: Alchemy::Admin::CspProtection
- Extended by:
- ActiveSupport::Concern
- Included in:
- BaseController
- Defined in:
- app/controllers/concerns/alchemy/admin/csp_protection.rb
Overview
Applies Alchemy's own Content Security Policy to the including controller.
Include it into any controller that renders the Alchemy admin but does not
inherit from Alchemy::Admin::BaseController, so that its responses carry
the same policy as the rest of the admin:
class Alchemy::Admin::PasswordsController < Devise::PasswordsController
include Alchemy::Admin::CspProtection
end
Including it is opting in, so the policy applies to every action. Override
apply_content_security_policy? to narrow that down.
The policy itself comes from Alchemy.config.admin_content_security_policy
and is left alone when the host application configured one of its own.