You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
wot-graph: one vote per trusted account, and re-key the cache when membership settings change #1250
Three related authorisation mechanisms in src/services/wot-graph-service.ts, from the 2026-11-01 scan: F-005 (authorization bypass, CWE-863), F-008 (CWE-863), F-010 (CWE-863). All three end in a proof-of-work discount granted to an account that should not have it. Reachability was not established by the scan.
Current code (main 49f51378)
F-005 — one account can vote repeatedly.rebuild() increments followerCounts once per entry returned by getFollows(). The Redis path is deduplicated by addToSet, but the database fallback returns extractFollowedPubkeys(tags) unfiltered, so a kind-3 that repeats a p tag makes one author satisfy a minimumFollowers threshold meant for several distinct accounts.
F-008 — the cache outlives its settings. The built graph is ready: boolean plus a plain distances map. A hot-reloaded wot.seedPubkey, maxDepth or minimumFollowers leaves the old distances serving discounts until something else triggers a rebuild.
F-010 — only the receiving worker rebuilds. Each worker holds its own graph; updateFollowList() schedules a rebuild in the worker that handled the event. A peer worker keeps granting a discount for a relationship that has been removed.
Fix shape
Deduplicate each author's follows before counting, on both the cache and database paths.
Key the built graph on (seedPubkey, maxDepth, minimumFollowers) and refuse to serve a graph whose key does not match current settings.
Publish an invalidation (cache key or version) when an accepted contact-list change affects membership, and have every worker check it before granting a trust-based discount.
Acceptance
A kind-3 repeating one p tag counts as one vote.
Changing minimumFollowers withholds discounts until a rebuild for the new key completes.
With two instances, the second stops granting after an invalidation without being the one that handled the event.
Activity