abuse reports: signed reports, gossip and sync, a local hide rule, visitor tips

A report is signed by a node operator (device key and certificate) and
gossiped on one global topic. Each node decides whose reports count: the
operator's own report hides a listing on that node, one trusted report of
illegal content hides it, and --hide-after trusted scam reports hide it
(--trust-reporter names others). Hidden listings stay stored and reachable.
Visitors can tip the node's operator off with a proof-of-work request that
hides nothing.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
This commit is contained in:
2026-11-18 21:18:43 +01:00
co-authored by Claude Sonnet 5.5
parent 253eb6e75c
commit 6d55222ac5
17 changed files with 1854 additions and 13 deletions
+69 -4
View File
@@ -516,13 +516,78 @@ the peers it has met in `peers.json` next to its keys.
## Spam
Proof-of-work per listing and per revocation, plus subscribable blocklists
(not built yet). The format leaves room for vouching signatures later.
Proof-of-work per listing and per revocation, abuse reports (below), and
subscribable blocklists (not built yet). The format leaves room for vouching
signatures later.
## Abuse reports
Implemented in `internal/report` (the record), `internal/store/reports.go`
(storage and the hide rule) and `internal/api/reports.go`. A report is
**information, not a verdict**: no report removes anything from the network.
Each node decides whose reports count, and what a listing that enough trusted
reporters flagged looks like *on that node*: hidden from search, behind a
notice, still stored and still reachable by its link.
**The record.** Canonical JSON, at most 4 KB, signed like a listing (device
key plus the certificate that chains to the reporter's identity key, and
proof-of-work at the listing difficulty): `listing {author, id}`, `category`
(`scam`, `illegal`, `category`, `other` or `withdrawn`), `note` (at most 300
bytes, no control characters), `created_at`, `expires_at` (at most 30 days
later, so a hide lapses unless it is renewed), `reporter`, `device`, `cert`,
`pow`, `sig`. A reporter has **one report per listing**: a newer one replaces
the older (the smaller hash on a tie), and `withdrawn` takes a report back.
Reports of a revoked device are dropped, and none are accepted from it.
**Network.** Reports travel on one global topic, `/allmende/1/reports`
(they are few, and every node may want them), validated like revocations:
canonical form, signature, proof-of-work, certificate; a clock mismatch or a
revoked device is ignored without penalty. Sync adds a `reports` digest to the
`digest` reply and a `reports` kind that returns the live reports (up to
5000); so a node that was offline catches up, and anti-entropy repairs the
rest.
**Who counts (the hide rule).** Local, in `store.Trust`:
- the **node's own operator** (`Self`): one report as `scam` or `illegal`
hides the listing on this node at once;
- **one** report of `illegal` from any trusted reporter hides it;
- `--hide-after N` (default 2) distinct trusted reporters flagging `scam` or
`illegal` hide it;
- trusted reporters are the operator and the keys given with
`--trust-reporter <identity key>` (repeatable; a node shows its key as
`author` in `/api/v1/status`);
- reports from anyone else are kept, shown as a count, and **never** counted;
- `category` and `other` only label.
A hidden listing is left out of search unless `?hidden=1`; its own page
(`#/l/<author>/<id>`) shows who flagged it.
**What visitors can do.** A visitor has no key, so they cannot sign. On a
listing page they can *tip off* the node they are using: `POST
/api/v1/signals` with category, note and proof-of-work at the message
difficulty (a canonical JSON body; the browser mines it as it does for
messages). The node keeps it **only for its operator** (a signal is not
gossiped, hides nothing, is limited per listing and overall, expires after 30
days, and sending the same one twice adds nothing). The operator sees the tips
(`GET /api/v1/signals`, strongest first) and may sign a report of their own
(`POST /api/v1/reports`), which also clears the tips about that listing, or
dismiss them (`DELETE /api/v1/signals/{author}/{id}`). So harassing a seller
with many tips costs work and changes nothing unless the operator agrees.
**HTTP.** Public: `GET /api/v1/reports?author=&id=` (what this node makes of
the reports: `hidden`, `trusted` counts per category, `others`, `signals`,
`own`), `POST /api/v1/signals`, and `GET /api/v1/listings?hidden=1`. Operator
(admin token): `GET /api/v1/signals`, `DELETE /api/v1/signals/{author}/{id}`,
`POST /api/v1/reports` (`{listing, category, note}`).
**Not built yet:** vouching (who becomes trusted is the operator's choice for
now), signed blocklists you subscribe to by curator key, an owner's signed
reply to a report, and reputation for reporters whose reports are overruled.
## Open
Abuse reporting for messages, reciprocity rules, anti-
discrimination (AGG) content rules, blocklists, peer scoring and rate limits,
Abuse reporting for messages (reports cover listings only so far), vouching
and blocklists for reports, reciprocity rules, anti-
discrimination (AGG) content rules, peer scoring and rate limits,
a fallback bootstrap list inside the binary
for networks that block DNS, image hosting,
recovering listings onto a fresh machine with an empty database, a helper to