File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 "fmt"
66 "iter"
77 "net/http"
8+ "slices"
89
910 "fiatjaf.com/nostr"
1011 "fiatjaf.com/nostr/khatru"
@@ -157,7 +158,12 @@ func query(ctx context.Context, filter nostr.Filter) iter.Seq[nostr.Event] {
157158 }
158159 }
159160
160- // otherwise add the authenticated user to the filter so that is enforced
161+ // otherwise constrain the filter to the authenticated user's own events.
162+ // if the client asked for specific authors, only honor it when it includes
163+ // the authed user, so we never return events that don't match the request
164+ if len (filter .Authors ) > 0 && ! slices .Contains (filter .Authors , authed ) {
165+ return func (yield func (nostr.Event ) bool ) {}
166+ }
161167 filter .Authors = []nostr.PubKey {authed }
162168 return db .QueryEvents (filter , global .Settings .Limits .MaxQueryLimit )
163169}
You can’t perform that action at this time.
0 commit comments