From 637de481e5434499ac5083829329876cdea78f53 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Tue, 4 Nov 2025 21:19:54 -0300 Subject: [PATCH] khatru: fix bug that caused a query with limit zero to bypass request filtering. spotted by hodlbod. --- khatru/responding.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/khatru/responding.go b/khatru/responding.go index c33dff6..ec08602 100644 --- a/khatru/responding.go +++ b/khatru/responding.go @@ -12,11 +12,6 @@ import ( func (rl *Relay) handleRequest(ctx context.Context, id string, eose *sync.WaitGroup, ws *WebSocket, filter nostr.Filter) error { defer eose.Done() - if filter.LimitZero { - // don't do any queries, just subscribe to future events - return nil - } - // then check if we'll reject this filter (we apply this after overwriting // because we may, for example, remove some things from the incoming filters // that we know we don't support, and then if the end result is an empty @@ -27,6 +22,11 @@ func (rl *Relay) handleRequest(ctx context.Context, id string, eose *sync.WaitGr } } + if filter.LimitZero { + // don't do any queries, just subscribe to future events + return nil + } + // run the function to query events if nil != rl.QueryStored { for event := range rl.QueryStored(ctx, filter) {