Skip to content

Conversation

LaurenceJJones
Copy link
Contributor

@LaurenceJJones LaurenceJJones commented Aug 15, 2025

based on the same option in cs-firewall-bouncer to keep consistency.

What

  • Add decision type filtering via config and per-request query parameter.

  • Update to Go 1.24 and refresh all module dependencies.

  • Migrate to standard library slices.

  • Why

    • Allow consumers to restrict blocklists to specific decision types (e.g., ban, captcha).
    • Enable per-request overrides without changing server config.

Changes

  • Config
    • pkg/cfg/config.go: add crowdsec_config.supported_decisions_types: []string.
  • Registry
    • pkg/registry/registry.go: store SupportedDecisionTypes and filter in GetActiveDecisions; per-request override via query param; use stdlib slices.Contains; remove "all" special-case.
  • Wiring
    • cmd/root.go: propagate supported_decisions_types into registry.GlobalDecisionRegistry.SupportedDecisionTypes.
  • Tooling
    • go.mod: bump to Go 1.24, upgrade deps, tidy.
    • Use stdlib slices (no x/exp).

Usage

  • YAML
crowdsec_config:
  # ...
  supported_decisions_types:
    - ban
  • If the list is empty or the key is omitted, no type filtering is applied.

  • Matching is case-insensitive.

  • Per-request override (query param)

    • Comma-separated or repeated params are supported:
      • /security/blocklist?supported_decisions_types=ban,captcha
      • /security/blocklist?supported_decisions_types=ban&supported_decisions_types=captcha
    • If the parameter is omitted, the YAML setting applies.
    • To get all types, omit the parameter and leave YAML empty (or enumerate desired types explicitly).
  • Other filters

    • Can be combined with ipv4only, ipv6only, origin, nosort.

@LaurenceJJones LaurenceJJones linked an issue Aug 15, 2025 that may be closed by this pull request
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.

Do not include IPs with "action = captcha" in blocklist
1 participant