upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/nix/module.nix
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-01-12 21:51:57 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-01-12 21:51:57 +0000
commitc8ab2c9c294ae9401ff542d0eecc6606b7908412 (patch)
tree2ecf96e0265c855940df149781a0a24640408e1e /nix/module.nix
parent70c577f10bbe150b6b13bec545dc8720ad005a64 (diff)
feat(config): add event blacklist to block all events from specific authors
Adds NGIT_EVENT_BLACKLIST option for blocking all events from specific npubs, taking precedence over all other validation to enable comprehensive moderation without affecting curation policy. Key features: - Simple npub-only format: <npub>,<npub>,... - Checked FIRST before any other validation (including repository blacklist) - Blocks ALL event types (announcements, state events, PRs, comments, etc.) - Events never reach relay storage or purgatory - Specific rejection reason for operator debugging Implementation: - Add EventBlacklistConfig struct with check() method - Add NGIT_EVENT_BLACKLIST config option and event_blacklist_config() method - Add config field to PolicyContext for policy access - Add check_event_blacklist() to Nip34WritePolicy - Check event blacklist first in admit_event() method (before any other validation) - 4 new unit tests covering all blacklist behavior Configuration synced across all four sources: - src/config.rs: Core implementation with EventBlacklistConfig - .env.example: Comprehensive documentation with examples - docs/reference/configuration.md: Complete reference documentation - nix/module.nix: NixOS module option with environment mapping README updates: - Add comprehensive "Curation & Moderation" section - Document repository whitelists (GRASP-01 and GRASP-05 modes) - Document repository and event blacklists with precedence order - Add configuration table for all curation/moderation settings - Provide real-world examples for different relay configurations Testing: - 4 new tests for event blacklist functionality - All 336 library tests passing - All 64 integration tests passing - All 38 filter support tests passing Verification: - Repository blacklist confirmed to apply to sync (uses same admit_event flow) - Sync events validated through process_event_static -> write_policy.admit_event Use cases: - Block spam/abusive users completely - Prevent malicious actors from submitting any events - Temporary blocks for investigation - Moderation without affecting whitelist curation policy
Diffstat (limited to 'nix/module.nix')
-rw-r--r--nix/module.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/nix/module.nix b/nix/module.nix
index cfac0fc..799ae2d 100644
--- a/nix/module.nix
+++ b/nix/module.nix
@@ -237,6 +237,19 @@ let
237 ''; 237 '';
238 }; 238 };
239 239
240 eventBlacklist = mkOption {
241 type = types.listOf types.str;
242 default = [ ];
243 example = [ "npub1spam..." "npub1abuser..." ];
244 description = ''
245 Event blacklist for blocking all events from specific authors (npubs).
246 Takes precedence over ALL other validation (checked first).
247 ALL events from these authors are rejected from relay storage and purgatory.
248 Applies to announcements, state events, PRs, and all other event types.
249 Does not affect NIP-11 metadata (operational, not curation policy).
250 '';
251 };
252
240 user = mkOption { 253 user = mkOption {
241 type = types.str; 254 type = types.str;
242 default = "ngit-grasp-${name}"; 255 default = "ngit-grasp-${name}";
@@ -281,6 +294,7 @@ let
281 NGIT_ARCHIVE_WHITELIST = concatStringsSep "," cfg.archiveWhitelist; 294 NGIT_ARCHIVE_WHITELIST = concatStringsSep "," cfg.archiveWhitelist;
282 NGIT_REPOSITORY_WHITELIST = concatStringsSep "," cfg.repositoryWhitelist; 295 NGIT_REPOSITORY_WHITELIST = concatStringsSep "," cfg.repositoryWhitelist;
283 NGIT_REPOSITORY_BLACKLIST = concatStringsSep "," cfg.repositoryBlacklist; 296 NGIT_REPOSITORY_BLACKLIST = concatStringsSep "," cfg.repositoryBlacklist;
297 NGIT_EVENT_BLACKLIST = concatStringsSep "," cfg.eventBlacklist;
284 RUST_LOG = cfg.logLevel; 298 RUST_LOG = cfg.logLevel;
285 } // optionalAttrs (cfg.relayName != null) { 299 } // optionalAttrs (cfg.relayName != null) {
286 NGIT_RELAY_NAME = cfg.relayName; 300 NGIT_RELAY_NAME = cfg.relayName;