Skip to content

Add Music Assistant artwork allowlist parser - #2012

Open
luxebenen wants to merge 2 commits into
crowdsecurity:masterfrom
luxebenen:feature/music-assistant-allowlist
Open

luxebenen wants to merge 2 commits into
crowdsecurity:masterfrom
luxebenen:feature/music-assistant-allowlist

Conversation

@luxebenen

Copy link
Copy Markdown

This is my first attempt at making a contribution to crowdsec. I used the Big Pickle LLM in OpenCode to help me set this up. My crowdsec setup banned my while using Music Assistant, and I found out it came from scrolling the library which triggers a lot of requests for downloading album/song artwork. I did not find an existing allowlist for this scenario, so I thought it might be a good case for a first attempt at writing my first PR. I reviewed the files in the PR myself and tested it on my live setup, it works for my case, I am not getting bans anymore while scrolling my library.

The content below is generated by the AI.


Description

Adds crowdsecurity/music-assistant-allowlist, a parser that allowlists Music Assistant album-artwork requests so that opening a library does not trigger crowdsecurity/http-crawl-non_statics.

Music Assistant serves artwork from GET /imageproxy/<sha256>?size=…&checksum=…. The path has no file extension, so crowdsecurity/http-logs classifies it as a non-static resource, and every artwork has a distinct hash. Loading a library therefore produces dozens of distinct URLs in seconds and crosses the capacity of http-crawl-non_statics.

Observed on a real Traefik → Music Assistant deployment, loading one library on a phone:

  • crowdsecurity/http-crawl-non_statics after 45+ distinct /imageproxy/<hash> requests;
  • then crowdsecurity/http-probing and LePresidente/http-generic-403-bf fired from the resulting 403 responses while the phone was already banned.

The second and third are cascades of the first, so this parser allowlists only the requests Music Assistant itself serves.

What is matched

GET on /imageproxy/ followed by a 64-character hexadecimal hash, with status 200, 304, 404 or 499. The query string and a trailing slash are optional.

  • 404 is included: Music Assistant answers 404 when an artwork id is no longer known or the upstream artwork provider cannot serve the image.
  • 499 is included: clients cancel artwork requests while scrolling.
  • 403 is deliberately excluded: it is the reverse proxy or an existing CrowdSec ban refusing the client, not Music Assistant. Allowlisting it would hide http-probing / http-generic-403-bf evidence, so those events stay detectable. The test contains a negative-control event for this.

Only this path is matched. /, /ws, /sendspin, malformed ids and any other verb or status are still parsed normally.

Tests

.tests/music-assistant-allowlist feeds 51 anonymized Traefik JSON events through traefik-logs, http-logs, dateparse-enrich and this parser:

  • 45 distinct artwork responses with 200 (enough to cross the http-crawl-non_statics capacity);
  • one artwork 304, one 499, one 404 → all allowlisted;
  • GET / 200 → not allowlisted;
  • /imageproxy/not-a-valid-hash 400 → not allowlisted;
  • a valid artwork hash with 403 → not allowlisted;
  • scenario.assert asserts zero alerts for the whole file.

Verified locally:

  • cscli hubtest run music-assistant-allowlist → 58 assertions pass;
  • removing the parser from the same fixture produces crowdsecurity/http-crawl-non_statics, so the test is meaningful;
  • hublint check → Checked 1433 items: 0 warnings, 0 errors;
  • on a live instance, cscli explain on a real request reports parser success, ignored by whitelist (Music Assistant allowlist), and no new alert appeared after installing the parser and unbanning the client.

Notes for reviewers

  • Standalone parser, no collection: this is application-specific, like crowdsecurity/actual-budget-whitelist.
  • The whitelist: YAML key is the CrowdSec directive and is unchanged; only the item name and reason use "allowlist", matching crowdsecurity/plex-allowlist.

Checklist

  • I have read the contributing guide
  • I have tested my changes locally
  • For new parsers or scenarios, tests have been added
  • I have run the hub linter and no issues were reported (see contributing guide)
  • Automated tests are passing
  • AI was used to generate any/all content of this PR

Luc van Dort added 2 commits November 15, 2026 21:56
Music Assistant serves album artwork from /imageproxy/<sha256>. The path has
no file extension, so http-logs marks it as a non-static resource and each
artwork has a distinct hash: loading a library triggers
crowdsecurity/http-crawl-non_statics, and the resulting 403s then cascade into
http-probing and http-generic-403-bf.

Allowlist GET /imageproxy/<64 hex hash> with status 200, 304, 404 or 499.
403 is intentionally not allowlisted because it means the client is already
blocked, so keep that signal detectable.

Tests cover the full artwork burst, 304/404/499 responses, and negative
controls for /, a malformed hash and a 403 on a valid hash.
Replace the private 192.168.1.100 client and 10.9.0.3 upstream with
192.0.2.100 (TEST-NET-1) and 198.51.100.10 (TEST-NET-2), as reserved by
RFC 5737 for documentation and examples.

This branch has not been deployed

No deployments
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