upleb.uk

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

summaryrefslogtreecommitdiff
path: root/README.md
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 /README.md
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 'README.md')
-rw-r--r--README.md100
1 files changed, 99 insertions, 1 deletions
diff --git a/README.md b/README.md
index 50bee24..b4a430f 100644
--- a/README.md
+++ b/README.md
@@ -36,7 +36,7 @@ Unlike the reference implementation ([ngit-relay](https://gitworkshop.dev/npub15
36- **Pure Rust Implementation**: Single binary, no external dependencies beyond Git itself 36- **Pure Rust Implementation**: Single binary, no external dependencies beyond Git itself
37- **Integrated Authorization**: Push validation happens inline during the Git receive-pack operation 37- **Integrated Authorization**: Push validation happens inline during the Git receive-pack operation
38- **GRASP-01 Compliant**: Core service requirements for Git hosting with Nostr authorization 38- **GRASP-01 Compliant**: Core service requirements for Git hosting with Nostr authorization
39 - **Repository Whitelist/Blacklist**: Optional curation via pubkey/identifier whitelist (GRASP-01 mode) and blacklist (overrides all whitelists) 39 - **Flexible Curation & Moderation**: Repository whitelists (GRASP-01 mode), repository blacklists (moderation), and event blacklists (author blocking)
40- **GRASP-02 Proactive Sync**: Sophisticated relay-to-relay event and git data synchronization 40- **GRASP-02 Proactive Sync**: Sophisticated relay-to-relay event and git data synchronization
41 - **NIP-77 Negentropy**: Efficient set reconciliation with automatic fallback to REQ+EOSE 41 - **NIP-77 Negentropy**: Efficient set reconciliation with automatic fallback to REQ+EOSE
42 - **Live & Historic Sync**: Real-time event streaming plus catch-up for past events 42 - **Live & Historic Sync**: Real-time event streaming plus catch-up for past events
@@ -150,6 +150,93 @@ See [GRASP-02 Proactive Sync](docs/explanation/grasp-02-proactive-sync.md) for f
150 150
151**See**: [GRASP-05 Archive Mode](docs/explanation/grasp-05-archive.md) 151**See**: [GRASP-05 Archive Mode](docs/explanation/grasp-05-archive.md)
152 152
153## Curation & Moderation
154
155ngit-grasp provides flexible tools for both curation (repository selection) and moderation (blocking spam/abuse):
156
157### Repository Whitelists (Curation)
158
159Control which repositories your relay accepts via two independent whitelist modes:
160
161**Repository Whitelist (GRASP-01 Mode):**
162- Only accept announcements that **both** list your service AND match the whitelist
163- Three formats: `<npub>`, `<npub>/<identifier>`, `<identifier>`
164- Environment: `NGIT_REPOSITORY_WHITELIST=npub1alice...,bitcoin-core`
165- Use case: Curated relay accepting specific projects/developers
166
167**Archive Whitelist (GRASP-05 Mode):**
168- Accept announcements matching the whitelist **even if they don't list your service**
169- Same three formats as repository whitelist
170- Environment: `NGIT_ARCHIVE_WHITELIST=npub1satoshi...,linux`
171- Use case: Backup/mirror relay for critical projects
172- Default: Read-only mode (`NGIT_ARCHIVE_READ_ONLY=true`)
173
174Both whitelists support flexible matching:
175```bash
176# Accept all repos from specific developer
177NGIT_REPOSITORY_WHITELIST=npub1alice...
178
179# Accept specific repository
180NGIT_REPOSITORY_WHITELIST=npub1alice.../my-project
181
182# Accept repos with specific identifier (any author)
183NGIT_REPOSITORY_WHITELIST=bitcoin-core
184```
185
186### Blacklists (Moderation)
187
188Block unwanted content without affecting your curation policy:
189
190**Repository Blacklist:**
191- Block specific repositories/developers/identifiers
192- **Takes precedence over ALL whitelists** (checked first)
193- Three formats: `<npub>`, `<npub>/<identifier>`, `<identifier>`
194- Environment: `NGIT_REPOSITORY_BLACKLIST=npub1spam...,malware-repo`
195- Use case: Block spam/malware repos while maintaining whitelist curation
196
197**Event Blacklist:**
198- Block **ALL events** from specific authors (npubs)
199- **Takes precedence over ALL other validation** (checked first)
200- Applies to all event types: announcements, state events, PRs, comments, etc.
201- Events never reach relay storage or purgatory
202- Environment: `NGIT_EVENT_BLACKLIST=npub1spammer...,npub1abuser...`
203- Use case: Block abusive users completely
204
205### Precedence & Interaction
206
207Validation order (from first to last):
208
2091. **Event Blacklist** → Reject if author is blacklisted (ALL event types)
2102. **Repository Blacklist** → Reject if repository/npub/identifier is blacklisted (announcements only)
2113. **Repository Whitelist** → Accept if announcement lists service AND matches whitelist
2124. **Archive Whitelist** → Accept if announcement matches whitelist (even without listing service)
2135. **Default GRASP-01** → Accept if announcement lists service (no whitelist configured)
214
215Examples:
216```bash
217# Curated relay blocking spam
218NGIT_REPOSITORY_WHITELIST=npub1alice...,npub1bob...
219NGIT_REPOSITORY_BLACKLIST=npub1alice.../spam-repo
220NGIT_EVENT_BLACKLIST=npub1spammer...
221# Result: Accept Alice & Bob's repos EXCEPT Alice's spam-repo, block all events from spammer
222
223# Archive relay with moderation
224NGIT_ARCHIVE_WHITELIST=bitcoin-core,linux
225NGIT_EVENT_BLACKLIST=npub1abuser...
226# Result: Mirror bitcoin-core and linux projects, block all events from abuser
227
228# Public relay with spam protection
229NGIT_EVENT_BLACKLIST=npub1spam1...,npub1spam2...
230# Result: Accept all GRASP-01 repos, block all events from spammers
231```
232
233**Privacy & Transparency:**
234- Blacklists are **not advertised** in NIP-11 metadata (operational, not curation policy)
235- Rejected events receive specific error messages for operator debugging
236- No client-visible indication that blacklists are in use
237
238**See**: [Configuration Reference](docs/reference/configuration.md) for complete details
239
153## Roadmap 240## Roadmap
154 241
155### GRASP-02 Enhancements 242### GRASP-02 Enhancements
@@ -326,6 +413,17 @@ NGIT_RELAY_OWNER_NSEC=nsec1... ngit-grasp --domain relay.example.com
326| Disable negentropy | `--sync-disable-negentropy` | `NGIT_SYNC_DISABLE_NEGENTROPY` | `false` | 413| Disable negentropy | `--sync-disable-negentropy` | `NGIT_SYNC_DISABLE_NEGENTROPY` | `false` |
327| Batch window | N/A | `NGIT_SYNC_BATCH_WINDOW_MS` | `5000` ms | 414| Batch window | N/A | `NGIT_SYNC_BATCH_WINDOW_MS` | `5000` ms |
328 415
416#### Curation & Moderation Settings
417
418| Option | CLI Flag | Environment Variable | Default |
419| -------------------- | --------------------------- | ------------------------------ | --------- |
420| Repository whitelist | `--repository-whitelist` | `NGIT_REPOSITORY_WHITELIST` | (empty) |
421| Archive whitelist | `--archive-whitelist` | `NGIT_ARCHIVE_WHITELIST` | (empty) |
422| Archive all | `--archive-all` | `NGIT_ARCHIVE_ALL` | `false` |
423| Archive read-only | `--archive-read-only` | `NGIT_ARCHIVE_READ_ONLY` | (auto) |
424| Repository blacklist | `--repository-blacklist` | `NGIT_REPOSITORY_BLACKLIST` | (empty) |
425| Event blacklist | `--event-blacklist` | `NGIT_EVENT_BLACKLIST` | (empty) |
426
329**Sync Notes:** 427**Sync Notes:**
330 428
331- **Bootstrap relay**: Optional starting point for relay discovery. System automatically discovers additional relays from repository announcements. URL scheme is optional - if not provided, `wss://` is assumed (e.g., `git.shakespeare.diy` → `wss://git.shakespeare.diy`). 429- **Bootstrap relay**: Optional starting point for relay discovery. System automatically discovers additional relays from repository announcements. URL scheme is optional - if not provided, `wss://` is assumed (e.g., `git.shakespeare.diy` → `wss://git.shakespeare.diy`).