Sha256: f61c80f276e5f2b79ef31f36290f5bcf7fb648cd08b7b0f0e6cbcb7a06046b88

Contents?: true

Size: 818 Bytes

Versions: 22

Compression:

Stored size: 818 Bytes

Contents

# frozen_string_literal: true

class Rails::ApplicationController < ActionController::Base # :nodoc:
  self.view_paths = File.expand_path("templates", __dir__)
  layout "application"

  before_action :disable_content_security_policy_nonce!

  content_security_policy do |policy|
    policy.script_src :self, :unsafe_inline
    policy.style_src :self, :unsafe_inline
  end

  private
    def require_local!
      unless local_request?
        render html: "<p>For security purposes, this information is only available to local requests.</p>".html_safe, status: :forbidden
      end
    end

    def local_request?
      Rails.application.config.consider_all_requests_local || request.local?
    end

    def disable_content_security_policy_nonce!
      request.content_security_policy_nonce_generator = nil
    end
end

Version data entries

22 entries across 20 versions & 2 rubygems

Version Path
railties-7.0.0.alpha2 lib/rails/application_controller.rb
railties-7.0.0.alpha1 lib/rails/application_controller.rb