From 0770f217a51254c95e12b7eae8d7a8a2e2b027a3 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Thu, 4 Sep 2025 10:13:08 -0300 Subject: [PATCH] khatru: prevent large indexable tags doesn't make any sense anymore as we don't index tags verbatim, only hashes. --- khatru/policies/events.go | 14 -------------- khatru/policies/strict_defaults.go | 1 - 2 files changed, 15 deletions(-) diff --git a/khatru/policies/events.go b/khatru/policies/events.go index 72d758d..b08b123 100644 --- a/khatru/policies/events.go +++ b/khatru/policies/events.go @@ -52,20 +52,6 @@ func PreventTooManyIndexableTags(max int, ignoreKinds []nostr.Kind, onlyKinds [] } } -// PreventLargeTags rejects events that have indexable tag values greater than maxTagValueLen. -func PreventLargeTags(maxTagValueLen int) func(context.Context, nostr.Event) (bool, string) { - return func(ctx context.Context, event nostr.Event) (reject bool, msg string) { - for _, tag := range event.Tags { - if len(tag) > 1 && len(tag[0]) == 1 { - if len(tag[1]) > maxTagValueLen { - return true, "event contains too large tags" - } - } - } - return false, "" - } -} - // PreventLargeContent rejects events with content too large func PreventLargeContent(maxContent int) func(context.Context, nostr.Event) (bool, string) { return func(ctx context.Context, event nostr.Event) (reject bool, msg string) { diff --git a/khatru/policies/strict_defaults.go b/khatru/policies/strict_defaults.go index 2073ecd..dbf3b58 100644 --- a/khatru/policies/strict_defaults.go +++ b/khatru/policies/strict_defaults.go @@ -8,7 +8,6 @@ import ( var EventRejectionStrictDefaults = SeqEvent( RejectEventsWithBase64Media, - PreventLargeTags(100), PreventTooManyIndexableTags(12, []nostr.Kind{3}, nil), PreventTooManyIndexableTags(1200, nil, []nostr.Kind{3}), PreventLargeContent(5000),