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
+14
View File
@@ -58,7 +58,20 @@ func cmdRun(args []string) error {
"proof-of-work bits for messages; must match the rest of the network")
maxNewThreads := fs.Int("max-new-threads", inbox.DefaultMaxNewThreads,
"how many new conversations each of your listings can start per day")
var trustReporters listFlag
fs.Var(&trustReporters, "trust-reporter",
"identity key (64 hex) of a node operator whose abuse reports count here; repeatable. Your own reports always hide a listing on your node")
hideAfter := fs.Int("hide-after", store.DefaultHideThreshold,
"how many trusted operators must report a listing as a scam before your node hides it (one report of illegal content is enough)")
fs.Parse(args)
for _, k := range trustReporters {
if !validKey(k) {
return fmt.Errorf("--trust-reporter %q: want an identity key of 64 hex characters (the \"author\" in a node's /api/v1/status)", k)
}
}
if *hideAfter < 1 {
return errors.New("--hide-after must be at least 1")
}
// Place names become region codes; say what each one turned into.
codes, notes, err := resolveRegions(regions, func() ([]places.Place, error) { return places.Load(web.Files()) })
@@ -112,6 +125,7 @@ func cmdRun(args []string) error {
st, err := store.Open(filepath.Join(*data, dbFile), store.Options{
Difficulty: *difficulty, MessageDifficulty: *msgDifficulty,
Trust: store.Trust{Self: dev.Cert.Author, Reporters: trustReporters, Threshold: *hideAfter},
})
if err != nil {
return err
+16
View File
@@ -0,0 +1,16 @@
package main
// validKey reports whether s is an identity key as shown by a node: 64
// lowercase hex characters.
func validKey(s string) bool {
if len(s) != 64 {
return false
}
for i := 0; i < len(s); i++ {
c := s[i]
if !(c >= '0' && c <= '9' || c >= 'a' && c <= 'f') {
return false
}
}
return true
}
+25
View File
@@ -0,0 +1,25 @@
package main
import (
"strings"
"testing"
)
func TestValidKey(t *testing.T) {
good := strings.Repeat("ab", 32)
if !validKey(good) {
t.Fatal("a 64-hex key was refused")
}
for name, k := range map[string]string{
"empty": "",
"short": good[:63],
"long": good + "a",
"uppercase": strings.ToUpper(good),
"not hex": strings.Repeat("zz", 32),
"a peer id": "12D3KooWNdEEecKvunKaTxsXd9W57cvaNeSndCACiXyDKBzkgZMQ",
} {
if validKey(k) {
t.Errorf("%s was accepted", name)
}
}
}