Skip to content

wot-graph: bound traversal work and rate-limit rebuilds #1249

Backlog

Description

@chappie-daemon

CodeRabbit's 2026-11-01 scan (F-002, low, denial of service, CWE-400) flagged src/services/wot-graph-service.ts. The scan never established reachability, so read this as a resource-bound question, not a confirmed attack.

Current code (main 49f51378): WotGraphService.rebuild() walks the graph level by level, awaiting getFollows() once per pubkey in the frontier and writing every newly seen pubkey into followerCounts and distances. Nothing bounds the frontier size, the number of follow-set reads, or the edge count — the breadth of one rebuild is set by signed kind-3 events from accounts already inside the graph. updateFollowList() calls scheduleRebuild() whenever the author is the seed or already in distances; the building/rebuildQueued pair coalesces an in-flight burst, but a steady stream of accepted contact lists still yields one full rebuild per burst.

Fix shape

  • Bound one rebuild: maximum pubkeys visited, maximum follow-set reads, maximum edges — configurable under wot with defaults. Stop at the bound and log which one was hit.
  • Rate-limit rebuilds triggered by contact-list updates to a minimum interval, independent of event admission.
  • Fetch follow sets in bounded batches instead of one await per pubkey.

Acceptance

  • A synthetic graph with an unbounded frontier stops at the configured bound and reports it.
  • N accepted kind-3 updates inside M seconds produce no more than the configured number of rebuilds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    security

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions