Skip to content

feat: support multiple blacklist providers#746

Merged
samcamwilliams merged 2 commits intoimpr/gunfrom
feat/multi-blacklist
Mar 11, 2026
Merged

feat: support multiple blacklist providers#746
samcamwilliams merged 2 commits intoimpr/gunfrom
feat/multi-blacklist

Conversation

@nikooo777
Copy link
Collaborator

Summary

  • Add blacklist_providers config key (JSON array) to configure multiple blacklist sources
  • Each provider is fetched independently with try/catch isolation so one failing provider doesn't break the rest
  • Blacklists from all providers are merged into a single ETS cache (union of all IDs)
  • Backward compatible: singular blacklist_provider key still works

Config example

{
  "blacklist_providers": [
    "/~relay@1.0/call?relay-method=GET&relay-path=https://provider-a.example.com/blacklist",
    "/~relay@1.0/call?relay-method=GET&relay-path=https://provider-b.example.com/blacklist"
  ],
  "on": {
    "request": { "device": "blacklist@1.0" }
  }
}

Note: blacklist@1.0 must be in the on/request hook chain to intercept requests. It is not in the default hook chain (hb_opts.erl), so it must be explicitly configured. This is also true for the existing singular blacklist_provider key.

Test plan

  • multiple_providers_test — two separate blacklists, IDs from both are blocked
  • backward_compat_test — singular key still works
  • provider_failure_resilience_test — bad provider doesn't break good ones
  • plural_numbered_message_test — numbered message map (structured config) works
  • Manual integration test with config.json + curl against running node

@samcamwilliams
Copy link
Collaborator

Looks good but no need for the backwards compat here. Clanker has over indexed on that, so the 'still works' test can go, much of the comment change, as well as plural_numbered_message_test, etc.

- Add `blacklist_providers` config key accepting a list of providers
- Keep backward compatibility with singular `blacklist_provider` key
- Each provider is fetched independently with try/catch isolation
- Merge all provider blacklists into a single ETS cache (union)
- Add tests for multi-provider, backward compat, failure resilience,
  and numbered-message config format
- Remove fallback to singular blacklist_provider key
- Remove numbered-message map handling from resolve_providers
- Remove ?DEFAULT_PROVIDER macro (stale under new plural API)
- Remove backward_compat_test and plural_numbered_message_test
- Update existing tests to use blacklist_providers
@nikooo777 nikooo777 force-pushed the feat/multi-blacklist branch from f90f7fb to 87d5dde Compare March 11, 2026 18:31
@samcamwilliams samcamwilliams merged commit 3b0bdd6 into impr/gun Mar 11, 2026
@samcamwilliams samcamwilliams deleted the feat/multi-blacklist branch March 11, 2026 19:11
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.

2 participants