Namespace
Module
Class
Methods
- block_all_mixed_content
- build
- initialize_copy
- new
- plugin_types
- report_uri
- require_sri_for
- sandbox
- upgrade_insecure_requests
Attributes
[R] | directives |
Class Public methods
new()
Source:
# File actionpack/lib/action_dispatch/http/content_security_policy.rb, line 143
def initialize
@directives = {}
yield self if block_given?
end
Instance Public methods
block_all_mixed_content(enabled = true)
Source:
# File actionpack/lib/action_dispatch/http/content_security_policy.rb, line 162
def block_all_mixed_content(enabled = true)
if enabled
@directives["block-all-mixed-content"] = true
else
@directives.delete("block-all-mixed-content")
end
end
build(context = nil, nonce = nil, nonce_directives = nil)
Source:
# File actionpack/lib/action_dispatch/http/content_security_policy.rb, line 208
def build(context = nil, nonce = nil, nonce_directives = nil)
nonce_directives = DEFAULT_NONCE_DIRECTIVES if nonce_directives.nil?
build_directives(context, nonce, nonce_directives).compact.join("; ")
end
initialize_copy(other)
Source:
# File actionpack/lib/action_dispatch/http/content_security_policy.rb, line 148
def initialize_copy(other)
@directives = other.directives.deep_dup
end
plugin_types(*types)
Source:
# File actionpack/lib/action_dispatch/http/content_security_policy.rb, line 170
def plugin_types(*types)
if types.first
@directives["plugin-types"] = types
else
@directives.delete("plugin-types")
end
end
report_uri(uri)
Source:
# File actionpack/lib/action_dispatch/http/content_security_policy.rb, line 178
def report_uri(uri)
@directives["report-uri"] = [uri]
end
require_sri_for(*types)
Source:
# File actionpack/lib/action_dispatch/http/content_security_policy.rb, line 182
def require_sri_for(*types)
if types.first
@directives["require-sri-for"] = types
else
@directives.delete("require-sri-for")
end
end