Class: Brut::FrontEnd::RouteHooks::CSPNoInlineStylesOrScripts

Inherits:
Brut::FrontEnd::RouteHook show all
Defined in:
lib/brut/front_end/route_hooks/csp_no_inline_styles_or_scripts.rb

Overview

Sets content security policy headers that forbid inline scripts and inline styles.

Direct Known Subclasses

ReportOnly

Defined Under Namespace

Classes: ReportOnly

Instance Method Summary collapse

Methods inherited from Brut::FrontEnd::RouteHook

#before, #continue

Methods included from Brut::Framework::Errors

#abstract_method!, #bug!

Methods included from HandlingResults

#http_status, #redirect_to

Instance Method Details

#after(response:) ⇒ Object



6
7
8
9
# File 'lib/brut/front_end/route_hooks/csp_no_inline_styles_or_scripts.rb', line 6

def after(response:)
  response.headers["Content-Security-Policy"] = header_value
  continue
end