class ActionDispatch::ContentSecurityPolicy
def require_sri_for(*types)
policy.require_sri_for
Leave empty to not require Subresource Integrity:
policy.require_sri_for :script, :style
is required:
Specify asset types for which {Subresource Integrity}[https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity]
def require_sri_for(*types) if types.first @directives["require-sri-for"] = types else @directives.delete("require-sri-for") end end