Skip to content

wot: get_follows caches its result after awaiting, so an older read can overwrite a newer follow list #1098

Open

Description

@chappie-daemon

get_follows reads storage, and then writes the cache unconditionally:

if !follows.is_empty() {
    self.inner.follows.lock()...insert(pubkey.to_owned(), follows.clone());
}

(crates/nostream-services/src/services/wot_graph_service.rs:296-303)

Between the await that reads the contact list and that insert, a newer list can be committed and update_follow_list can cache its follows. The older read then overwrites the newer entry, and the queued rebuild reuses a stale, non-empty cache — so the trust relationships stay wrong until another contact-list update arrives.

Fix shape: version what was read (a generation counter bumped by update_follow_list, or the read's created_at) and refuse to replace an entry newer than the read.

Surfaced by Greptile on #1094 (static/round-8.json). Pre-existing on rewrite/main.

Activity

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

    bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions