···180180 // Serve all textual content as plain text so the browser never
181181 // interprets knot-supplied markup or scripts.
182182 w.Header().Set("Content-Type", "text/plain; charset=utf-8")
183183- case safeBinaryMIMEType(mediaType) || contentType == "application/octet-stream":
183183+ case safeBinaryMIMEType(mediaType):
184184 // Use the normalized type, never the raw knot-supplied string.
185185 w.Header().Set("Content-Type", mediaType)
186186 default:
187187- w.WriteHeader(http.StatusUnsupportedMediaType)
188188- w.Write([]byte("unsupported content type"))
189189- return
187187+ // If mediatype is unknown or it's unsafe (e.g. SVG which allows XSS,)
188188+ // fallback to octet-stream
189189+ w.Header().Set("Content-Type", "application/octet-stream")
190190 }
191191 if _, err := io.Copy(w, resp.Body); err != nil {
192192 l.Error("error streaming knotmirror response", "err", err)