Documentation
¶
Overview ¶
Package csp contains a representation of Content-Security-Policy header directives.
Index ¶
Constants ¶
View Source
const ( BaseURI = "base-uri" ConnectSource = "connect-src" DefaultSource = "default-src" FormAction = "form-action" FrameAncestors = "frame-ancestors" ImageSource = "img-src" ScriptSource = "script-src" StyleSource = "style-src" WorkerSource = "worker-src" )
Directive names.
View Source
const ( KeywordBlob = "blob:" KeywordData = "data:" KeywordNone = "'none'" KeywordSelf = "'self'" KeywordUnsafeHashes = "'unsafe-hashes'" )
Keywords available for directives.
View Source
const HeaderKey = "Content-Security-Policy"
HeaderKey is the canonical header key.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContentSecurityPolicy ¶
ContentSecurityPolicy represents Content-Security-Policy header directives
func (ContentSecurityPolicy) Encoded ¶
func (policy ContentSecurityPolicy) Encoded() string
Encoded returns the encoded form of the header.
func (ContentSecurityPolicy) Middleware ¶
func (policy ContentSecurityPolicy) Middleware(next http.Handler) http.Handler
Middleware sets the Content-Security-Policy header in the handler's responses.
Click to show internal directories.
Click to hide internal directories.