Documentation
¶
Overview ¶
Package abuse is a web node's abuse reporting and enforcement, as an operator runs it on its own: signed reports arrive at the node, a report from a reporter the operator recognizes is applied to the deny list at once and any other waits for the operator, and every change to the list is appended to a log signed by the operator's key, naming the report it answers. Policy stays with each operator: nothing here binds another.
A report's fields are those the long-term report record carries (1bsv-ops docs/apps/bweb/abuse-plan.md section 3), so the same document rides a report channel on the plane when one exists.
Index ¶
Constants ¶
const MaxReport = 16 << 10
MaxReport bounds a report on the wire.
Variables ¶
var Categories = []string{"phishing", "malware", "csam", "copyright", "fraud", "harassment", "spam", "other"}
Categories a report may name.
var ErrQueueFull = errors.New("the report queue is full: try again later")
ErrQueueFull refuses a report from a reporter not recognized while the queue is at its bound.
var Kinds = []string{"site", "owner", "host", "root", "sha256"}
Kinds are the targets a report or a deny entry names, as the deny list spells them: a site by its id, every site of an owner key, a host name, an object by its closure root or its content hash.
Functions ¶
func ParseEntry ¶
ParseEntry reads kind:value, as a deny entry and a report's target spell it, and returns them lower case. A hashed entry is h:<64 hex>, the SHA-256 of another entry, so a list of the worst content can be shared without being a directory of it.
Types ¶
type Action ¶
type Action struct {
Time int64 `json:"time"`
Decision string `json:"decision"` // "refuse" or "decline"
Entry string `json:"entry,omitempty"`
Report string `json:"report"`
Reporter string `json:"reporter"`
Category string `json:"category"`
How string `json:"how"` // "recognized reporter" or "operator"
Note string `json:"note,omitempty"`
Policy string `json:"policy,omitempty"`
Operator string `json:"operator"`
Signature string `json:"signature"`
}
Action is one decision, as the log keeps it.
type Desk ¶
type Desk struct {
Dir string
DenyFile string
Key *ec.PrivateKey // the operator's key: it signs each action
Recognized map[string]bool // reporter keys whose reports apply at once
Policy string // the operator's policy, named in each action
Now func() time.Time
// MaxQueue bounds the reports waiting from reporters not recognized
// (default 1,000): past it they are refused until the operator acts.
MaxQueue int
// contains filtered or unexported fields
}
Desk is an operator's handling of reports on one node: reports are kept under Dir/queue until decided and Dir/done after; the deny list at DenyFile is what the node refuses; Dir/actions.log is the signed record of every decision.
func (*Desk) Act ¶
Act is the operator's decision on a queued report: refuse its target, or decline it, with a note.
type Report ¶
type Report struct {
Version int `json:"version"`
Reporter string `json:"reporter"` // a compressed key, 66 hex digits
Target string `json:"target"` // kind:value, as a deny entry
Category string `json:"category"`
Evidence string `json:"evidence,omitempty"` // a reference: a URL, a case number
Jurisdiction string `json:"jurisdiction,omitempty"`
Action string `json:"action"` // "refuse"
Created int64 `json:"created"`
Signature string `json:"signature"`
}
Report is one report of abuse. Signature is the reporter's, over Preimage, in DER and hex.
func (*Report) ID ¶
ID is the report's name: the SHA-256 of its preimage, hex. The signature is left out, so the same report signed again, or its signature re-encoded (an ECDSA signature has two valid forms), is the same report.