From d12bf4f350581ad38166239a00a608c02e86d039 Mon Sep 17 00:00:00 2001 From: eth0net Date: Wed, 23 Sep 2026 02:33:03 +0100 Subject: [PATCH] fix: only say a handle does not exist where that is knowable HandleNotFound means the resolution confirmed there is no DID. This server resolves nothing outside its own domains, so for anyone else's name it was asserting a result it had not looked for. The reference draws the same line. Signed-off-by: eth0net --- src/server/identity.rs | 9 ++++++++- tests/signup.rs | 6 ++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/server/identity.rs b/src/server/identity.rs index cbd22d0..c1825c3 100644 --- a/src/server/identity.rs +++ b/src/server/identity.rs @@ -48,6 +48,13 @@ pub(crate) async fn resolve_handle( }) }) .ok_or_else(|| { - xrpc::Error::invalid_request("Unable to resolve handle").named("HandleNotFound") + let unresolved = xrpc::Error::invalid_request("Unable to resolve handle"); + // Only a name this server answers for is one it can say does not + // exist. For anyone else's, not knowing is all this means. + if accounts.rules().is_local(&handle) { + unresolved.named("HandleNotFound") + } else { + unresolved + } }) } diff --git a/tests/signup.rs b/tests/signup.rs index dc38359..571dbb9 100644 --- a/tests/signup.rs +++ b/tests/signup.rs @@ -197,9 +197,11 @@ async fn a_handle_nothing_here_holds_is_not_resolved_for_a_client() { let (router, _data, _seen) = server(false).await; for (query, error) in [ + // A name this server hands out, so its absence is an answer. ("handle=nobody.pds.test", "HandleNotFound"), - // Somebody else's domain, which this server has no way to ask about. - ("handle=alice.example.com", "HandleNotFound"), + // Somebody else's domain, which this server has no way to ask about + // and therefore cannot say does not exist. + ("handle=alice.example.com", "InvalidRequest"), ("handle=not%20a%20handle", "InvalidHandle"), ] { let (status, body) = call( -- 2.54.0