Marten::HTTP::ContentSecurityPolicy
Represents a Content-Security-Policy response header.
This class can be leveraged to configure the value of the HTTP Content-Security-Policy response header and enhance protection against cross-site scripting (XSS) and injection attacks.
policy = Marten::HTTP::ContentSecurityPolicy.new do |csp|
csp.default_src = {:self, "example.com"}
end
policy.build # => "default-src 'self' example.com"
Constructors
Instance methods
Allows to set the base-uri directive or remove it (if a nil value is specified).
Allows to set the child-src directive or remove it (if a nil value is specified).
Allows to set the connect-src directive or remove it (if a nil value is specified).
Allows to set the default-src directive or remove it (if a nil value is specified).
Allows to set the font-src directive or remove it (if a nil value is specified).
Allows to set the form-action directive or remove it (if a nil value is specified).
Allows to set the frame-ancestors directive or remove it (if a nil value is specified).
Allows to set the frame-src directive or remove it (if a nil value is specified).
Allows to set the img-src directive or remove it (if a nil value is specified).
Allows to set the manifest-src directive or remove it (if a nil value is specified).
Allows to set the media-src directive or remove it (if a nil value is specified).
Allows to set the object-src directive or remove it (if a nil value is specified).
Allows to set the plugin-types directive or remove it (if a nil value is specified).
Allows to set the prefetch-src directive or remove it (if a nil value is specified).
Allows to set the report-to directive or remove it (if a nil value is specified).
Allows to set the report-uri directive or remove it (if a nil value is specified).
Allows to set the require-sri-for directive or remove it (if a nil value is specified).
Allows to set the sandbox directive or remove it (if a nil value is specified).
Allows to set the script-src directive or remove it (if a nil value is specified).
Allows to set the script-src-attr directive or remove it (if a nil value is specified).
Allows to set the script-src-elem directive or remove it (if a nil value is specified).
Allows to set the style-src directive or remove it (if a nil value is specified).
Allows to set the style-src-attr directive or remove it (if a nil value is specified).
Allows to set the style-src-elem directive or remove it (if a nil value is specified).