diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-12 17:40:25 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-12 17:40:25 +0000 |
| commit | c29191b1e1239e931c575a926ec9480e594476d6 (patch) | |
| tree | 6fcb776ba34b6fab766ceb613997b07b18e780df /.env.example | |
| parent | 2b8992631b9dedcfd4ea44e8565b14ac8a5ed8ea (diff) | |
feat(grasp-05): implement archive mode for backup/mirror operation
Implements GRASP-05 specification for accepting repository announcements
that don't list this relay, enabling archive, mirror, and backup use cases.
Core Features:
- Three whitelist formats: <npub>, <npub>/<identifier>, <identifier>
- Archive-all mode for complete ecosystem mirrors
- Fail-fast npub validation at startup
- Read-only enforcement (archived repos reject pushes)
- Full GRASP-02 sync (git data + Nostr events)
- Dynamic archive status (no flags/metadata)
Implementation:
- Add ArchiveWhitelistEntry enum with Pubkey/Repository/Identifier variants
- Add ArchiveConfig with validation and matching logic
- Update AnnouncementResult to include AcceptArchive variant
- Refactor validate_announcement() to return AnnouncementResult with archive check
- Update AnnouncementPolicy with catch-all pattern for cleaner code
- Wire archive config through builder and policy layers
Configuration:
- NGIT_ARCHIVE_ALL: Accept all announcements (⚠️ storage risk)
- NGIT_ARCHIVE_WHITELIST: Comma-separated whitelist entries
- Updated docs, .env.example, and nix/module.nix
Testing:
- 28 unit tests for config parsing and whitelist matching
- 7 integration tests for archive mode validation
- All 296 tests passing
Validation Priority:
1. Lists our service → Accept (GRASP-01, read/write)
2. Is maintainer → AcceptMaintainer (multi-maintainer, read/write)
3. Matches archive config → AcceptArchive (GRASP-05, read-only)
4. None of above → Reject
Security Considerations:
- Archive-all mode has storage/bandwidth DoS risk
- Identifier-only format matches any pubkey (use npub/identifier for high-value)
- Invalid npubs cause startup failure (fail-fast)
Documentation:
- Concise explanation focused on rationale
- Reference docs updated with all config options
- README updated to reflect completed feature
- Removed from roadmap, added to compliance section
See docs/explanation/grasp-05-archive.md for details.
Diffstat (limited to '.env.example')
| -rw-r--r-- | .env.example | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/.env.example b/.env.example index 6a93d78..2dc5266 100644 --- a/.env.example +++ b/.env.example | |||
| @@ -165,4 +165,28 @@ | |||
| 165 | # tracked separately and retried after this expiration period | 165 | # tracked separately and retried after this expiration period |
| 166 | # CLI: --naughty-list-expiration-hours <hours> | 166 | # CLI: --naughty-list-expiration-hours <hours> |
| 167 | # Default: 12 | 167 | # Default: 12 |
| 168 | # NGIT_NAUGHTY_LIST_EXPIRATION_HOURS=12 \ No newline at end of file | 168 | # NGIT_NAUGHTY_LIST_EXPIRATION_HOURS=12 |
| 169 | |||
| 170 | # ============================================================================ | ||
| 171 | # GRASP-05 ARCHIVE MODE | ||
| 172 | # ============================================================================ | ||
| 173 | |||
| 174 | # Accept all repository announcements (⚠️ WARNING: Storage/bandwidth risk) | ||
| 175 | # When enabled, any repository can be mirrored to this relay | ||
| 176 | # CLI: --archive-all | ||
| 177 | # Default: false | ||
| 178 | # NGIT_ARCHIVE_ALL=false | ||
| 179 | |||
| 180 | # Whitelist specific repos/pubkeys/identifiers for archiving | ||
| 181 | # Comma-separated list supporting three formats: | ||
| 182 | # <npub> - Archive all repos from this pubkey | ||
| 183 | # <npub>/<identifier> - Archive specific repo | ||
| 184 | # <identifier> - Archive repos with this identifier (any pubkey) | ||
| 185 | # | ||
| 186 | # CLI: --archive-whitelist <list> | ||
| 187 | # Default: (empty) | ||
| 188 | # Examples: | ||
| 189 | # NGIT_ARCHIVE_WHITELIST=npub1alice... | ||
| 190 | # NGIT_ARCHIVE_WHITELIST=npub1alice...,npub1bob.../linux | ||
| 191 | # NGIT_ARCHIVE_WHITELIST=bitcoin-core,linux,rust | ||
| 192 | # NGIT_ARCHIVE_WHITELIST= \ No newline at end of file | ||