khatru: fix bug that caused a query with limit zero to bypass request filtering.

spotted by hodlbod.
This commit is contained in:
fiatjaf
2025-11-04 21:19:54 -03:00
parent 38a6ca92b9
commit 637de481e5

View File

@@ -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) {