instance method validate

Ruby on Rails 7.0.10

Since v7.0.10 Private — implementation detail, not part of the public API

Available in: v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

validate(directive, sources)

No documentation comment.

Parameters

directive req
sources req
Source
# File actionpack/lib/action_dispatch/http/content_security_policy.rb, line 334
      def validate(directive, sources)
        sources.flatten.each do |source|
          if source.include?(";") || source != source.gsub(/[[:space:]]/, "")
            raise InvalidDirectiveError, <<~MSG.squish
              Invalid Content Security Policy #{directive}: "#{source}".
              Directive values must not contain whitespace or semicolons.
              Please use multiple arguments or other directive methods instead.
            MSG
          end
        end
      end

Defined in actionpack/lib/action_dispatch/http/content_security_policy.rb line 334 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionDispatch::ContentSecurityPolicy

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close