Skip to content

feat(blocklist): block domains listed in config.json at the cache-bucket root - #22

Merged
robbiebyrd merged 1 commit into
mainfrom
feat/blocked-domains
Jul 21, 2026
Merged

feat(blocklist): block domains listed in config.json at the cache-bucket root#22
robbiebyrd merged 1 commit into
mainfrom
feat/blocked-domains

Conversation

@robbiebyrd

Copy link
Copy Markdown
Collaborator

What

Adds an optional domain blocklist to the time-machine-web-proxy. An optional config.json at the root of the shared cache bucket (FUSE-mounted at CACHE_DIR) stops the proxy from retrieving, caching, or serving matching hosts.

{
  "blocked_domains": ["example.com", "*.tracker.net"]
}

Behavior

  • blocked_domains — array of hosts. Wildcard entries (*.example.com) use the same subdomain+apex semantics as WHITELIST_HOSTS.
  • Missing file → no blocklist. No error is raised when config.json is absent.
  • Malformed file → keeps the previously loaded list (fails safe, doesn't crash).
  • Blocked requests return a distinct HTTP 451 on every path: HTTP, SSE, WebSocket, and admin crawl.
  • Prewarm skips blocked asset hosts embedded in otherwise-allowed pages.
  • The file is re-read at most once per minute, so bucket edits apply without a restart.

Files

  • src/lib/blocklist.ts (new) — core loader + matcher
  • src/lib/dependencies.ts, src/services/proxy.ts, src/services/time-machine.ts — wiring
  • tests/lib/blocklist.test.ts, tests/services/proxy.test.ts — coverage
  • README.md — docs

🤖 Generated with Claude Code

…ket root

An optional { "blocked_domains": [...] } config file at the root of the
shared cache bucket (FUSE-mounted at CACHE_DIR) stops the proxy from
retrieving, caching, or serving matching hosts. Wildcard entries
(*.example.com) use the same subdomain+apex semantics as WHITELIST_HOSTS.
Blocked requests fail with a distinct 451 status on every path (HTTP,
SSE, WebSocket, admin crawl), and prewarm skips blocked asset hosts
embedded in allowed pages. A missing file means no blocklist; the list
is re-read at most once per minute so bucket edits apply without a
restart, and a malformed file keeps the previously loaded list.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@robbiebyrd
robbiebyrd merged commit 734d8b8 into main Jul 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant