Documentation
¶
Overview ¶
Package csp captures browser security reports: Content Security Policy violations (report-uri, application/csp-report) and Reporting API reports (report-to, application/reports+json: csp-violation, deprecation, intervention, crash, ...). Point a policy at http://<buggregator>/csp or /csp/<project>.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Module ¶
type Module struct {
module.BaseModule
}
Module is the CSP / Reporting API catcher.
func (*Module) HTTPHandler ¶
func (m *Module) HTTPHandler() module.HTTPIngestionHandler
func (*Module) PreviewMapper ¶
func (m *Module) PreviewMapper() event.PreviewMapper
type Payload ¶
type Payload struct {
Format string `json:"format"` // csp-report or reports+json
Reports []Report `json:"reports"`
}
Payload is the stored event: one request's reports.
type Report ¶
type Report struct {
// Type: csp-violation for CSP (both formats), else the Reporting API
// type (deprecation, intervention, crash, network-error, ...).
Type string `json:"type"`
URL string `json:"url"` // the page that reported
UserAgent string `json:"user_agent,omitempty"`
// CSP violations.
Directive string `json:"directive,omitempty"` // effective directive: script-src-elem
Blocked string `json:"blocked,omitempty"` // blocked URL, or inline / eval
Disposition string `json:"disposition,omitempty"`
SourceFile string `json:"source_file,omitempty"`
Line int `json:"line,omitempty"`
Column int `json:"column,omitempty"`
Sample string `json:"sample,omitempty"`
Policy string `json:"policy,omitempty"`
// Other report types: the message and id (deprecation, intervention).
Message string `json:"message,omitempty"`
ID string `json:"id,omitempty"`
// Body is the report as the browser sent it.
Body json.RawMessage `json:"body"`
}
Report is one report, the same shape for both formats.