khatru: fix bug that caused a query with limit zero to bypass request filtering.
spotted by hodlbod.
This commit is contained in:
@@ -12,11 +12,6 @@ import (
|
|||||||
func (rl *Relay) handleRequest(ctx context.Context, id string, eose *sync.WaitGroup, ws *WebSocket, filter nostr.Filter) error {
|
func (rl *Relay) handleRequest(ctx context.Context, id string, eose *sync.WaitGroup, ws *WebSocket, filter nostr.Filter) error {
|
||||||
defer eose.Done()
|
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
|
// 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
|
// 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
|
// 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
|
// run the function to query events
|
||||||
if nil != rl.QueryStored {
|
if nil != rl.QueryStored {
|
||||||
for event := range rl.QueryStored(ctx, filter) {
|
for event := range rl.QueryStored(ctx, filter) {
|
||||||
|
|||||||
Reference in New Issue
Block a user