Sanitize queue_item.name in icy headers (#3112)
authorFabian Munkes <105975993+fmunkes@users.noreply.github.com>
Sun, 8 Feb 2026 18:34:29 +0000 (19:34 +0100)
committerGitHub <noreply@github.com>
Sun, 8 Feb 2026 18:34:29 +0000 (19:34 +0100)
music_assistant/controllers/streams/streams_controller.py

index 683b8e958414918cb9432a34c8251c9c89e6e47d..7dcd944774ee0eebcd7c28963bc653ac98ba69ff 100644 (file)
@@ -448,9 +448,11 @@ class StreamsController(CoreController):
         )
 
         # prepare request, add some DLNA/UPNP compatible headers
+        # icy-name is sanitized to avoid a "Potential header injection attack" exception by aiohttp
+        # see https://github.com/music-assistant/support/issues/4913
         headers = {
             **DEFAULT_STREAM_HEADERS,
-            "icy-name": queue_item.name,
+            "icy-name": queue_item.name.replace("\n", " ").replace("\r", " ").replace("\t", " "),
             "contentFeatures.dlna.org": "DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01500000000000000000000000000000",  # noqa: E501
             "Accept-Ranges": "none",
             "Content-Type": f"audio/{output_format.output_format_str}",