From af087a816f870ea943c61624d496b1d5e4d090b9 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 16 Nov 2026 20:52:59 +0000 Subject: api: in a swarm holding a store, a node takes no token another issued At its API, a node of a swarm holding a store takes no token another node issued (`docs/store.md`, Members): whoever its operator lets in may use it, and its operator lets in nobody through another node. A token every node of a swarm takes would let whoever another operator let in in here too. `token::issued_here` refuses such a token (`ElsewhereIssued`), behind the `federation` feature. --- src/api/login.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/api') diff --git a/src/api/login.rs b/src/api/login.rs index c5cbe8d..0658a69 100644 --- a/src/api/login.rs +++ b/src/api/login.rs @@ -112,7 +112,11 @@ pub(crate) async fn bearer( let now = state.clock.now_millis().as_u64(); let verified = { let replica = state.doc.read().await; - token::verify(&replica.doc, &text, &swarm, now) + let verified = token::verify(&replica.doc, &text, &swarm, now); + #[cfg(feature = "federation")] + let verified = + verified.and_then(|claims| token::issued_here(&replica.doc, state.local_id(), claims)); + verified } .and_then(|claims| { // Ended here where the document can't record it (no registry). -- cgit v1.3.1