Sha256: e920839e6a54f1893e0b3d0959e7c491dda450b85b804eeb09d935638fd65d70

Contents?: true

Size: 685 Bytes

Versions: 42

Compression:

Stored size: 685 Bytes

Contents

# frozen_string_literal: true

module ActionView
  module Helpers # :nodoc:
    # = Action View CSP \Helpers
    module CspHelper
      # Returns a meta tag "csp-nonce" with the per-session nonce value
      # for allowing inline <script> tags.
      #
      #   <head>
      #     <%= csp_meta_tag %>
      #   </head>
      #
      # This is used by the \Rails UJS helper to create dynamically
      # loaded inline <script> elements.
      #
      def csp_meta_tag(**options)
        if content_security_policy?
          options[:name] = "csp-nonce"
          options[:content] = content_security_policy_nonce
          tag("meta", options)
        end
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 6 rubygems

Version Path
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/actionview-7.1.3.4/lib/action_view/helpers/csp_helper.rb
actionview-8.0.1 lib/action_view/helpers/csp_helper.rb
actionview-8.0.0.1 lib/action_view/helpers/csp_helper.rb
actionview-7.2.2.1 lib/action_view/helpers/csp_helper.rb
actionview-7.1.5.1 lib/action_view/helpers/csp_helper.rb
actionview-8.0.0 lib/action_view/helpers/csp_helper.rb
actionview-7.2.2 lib/action_view/helpers/csp_helper.rb
actionview-7.1.5 lib/action_view/helpers/csp_helper.rb
actionview-8.0.0.rc2 lib/action_view/helpers/csp_helper.rb
actionview-7.2.1.2 lib/action_view/helpers/csp_helper.rb
actionview-7.1.4.2 lib/action_view/helpers/csp_helper.rb
actionview-8.0.0.rc1 lib/action_view/helpers/csp_helper.rb
actionview-7.2.1.1 lib/action_view/helpers/csp_helper.rb
actionview-7.1.4.1 lib/action_view/helpers/csp_helper.rb
actionview-8.0.0.beta1 lib/action_view/helpers/csp_helper.rb
omg-actionview-8.0.0.alpha9 lib/action_view/helpers/csp_helper.rb
omg-actionview-8.0.0.alpha8 lib/action_view/helpers/csp_helper.rb
omg-actionview-8.0.0.alpha7 lib/action_view/helpers/csp_helper.rb
omg-actionview-8.0.0.alpha4 lib/action_view/helpers/csp_helper.rb
omg-actionview-8.0.0.alpha3 lib/action_view/helpers/csp_helper.rb