diff options
| author | tv <tv@krebsco.de> | 2026-11-25 15:27:53 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-25 15:27:53 +0000 |
| commit | e22f2e5c38baa1866793338fc7abde8c8e53b635 (patch) | |
| tree | f6e7225e05bc35467b638416fa8487d538d02fed /src/api/access.rs | |
| parent | 46fc2ab070b5f8d3cd6c8bd0d6bd15c624a061e5 (diff) | |
continuum-party vote: asks its node first whether a true is taken
A party's client recorded its vote, sent it, and only warned where its
node refused it: a true every node refuses, its party's earlier one not
dead where it builds, stayed in the record and bound the party, though no
node held it. Taking it back out on the node's word would let a node that
lies have its party vote twice.
So it asks before it signs: POST /events/back names the party, the
proposal and the events the vote would build on, and a node answers by
what it asks itself before it casts one (vote::takes_true). Nothing
signed is sent, so a node gets nothing it could pass on. Told it isn't
taken, the client casts and records nothing; a node that doesn't answer,
one before this, it says so of, and goes on as it did.
Diffstat (limited to 'src/api/access.rs')
| -rw-r--r-- | src/api/access.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/api/access.rs b/src/api/access.rs index 339d9de..9e8a018 100644 --- a/src/api/access.rs +++ b/src/api/access.rs @@ -452,7 +452,8 @@ fn federated(state: &AppState, request: &Request<Body>, user: &str) -> Option<Re } /// Whether a request is federation work: reading the events API (`GET` and `HEAD` of -/// `/events` and below), checking a fork (`POST /events/fork`), and keeping a session +/// `/events` and below), checking a fork (`POST /events/fork`), asking whether a `true` is +/// taken (`POST /events/back`), and keeping a session /// (`GET /auth/whoami`, `POST /auth/refresh`, `POST /auth/logout`); with `puts`, putting /// an event (`POST /events`) too. Nothing of the document (`/store`, `/stream`), the /// node (`/peers`, `/admin/…`), nor what a node's operator does to its store @@ -463,7 +464,7 @@ fn federation_work(method: &Method, path: &str, puts: bool) -> bool { let posts = *method == Method::POST; match path { "/auth/whoami" => reads, - "/auth/refresh" | "/auth/logout" | "/events/fork" => posts, + "/auth/refresh" | "/auth/logout" | "/events/fork" | "/events/back" => posts, "/events" => reads || (puts && posts), _ => reads && path.starts_with("/events/"), } @@ -493,6 +494,7 @@ mod tests { assert!(work(Method::GET, "/events/counts", false)); assert!(work(Method::HEAD, "/events/0c7e", false)); assert!(work(Method::POST, "/events/fork", false)); + assert!(work(Method::POST, "/events/back", false)); assert!(work(Method::POST, "/auth/refresh", false)); assert!(work(Method::GET, "/auth/whoami", false)); assert!(!work(Method::POST, "/events", false)); |
