diff --git a/internal/attachments/mime.go b/internal/attachments/mime.go index cc8d5294..d943eff2 100644 --- a/internal/attachments/mime.go +++ b/internal/attachments/mime.go @@ -109,8 +109,8 @@ var allowed = func() map[string]MIMEEntry { // --- Text & data (chip with download) --- for _, t := range []string{ "text/plain", "text/markdown", "text/csv", "text/tab-separated-values", - "application/json", "application/xml", "text/xml", - "application/yaml", "text/yaml", "application/toml", + "application/json", "text/xml", + "application/yaml", "application/toml", } { add(t, RenderChip, CategoryText) } @@ -124,8 +124,15 @@ var allowed = func() map[string]MIMEEntry { } // --- Forced-download text payloads — would XSS if served inline --- + // application/javascript was removed here (BUG-2963 F6): no extension in + // extMIMEMap reaches that spelling and SniffMIME cannot emit it, so the + // entry could never be the type an upload was stored under. text/javascript + // stays because .js maps to it — but note it is not reachable EITHER: a .js + // upload sniffs text/plain and is stored as that. The difference is that + // text/javascript has a route to become reachable (the F5 extension-trust + // work) and application/javascript has none, since nothing names it. for _, t := range []string{ - "text/html", "text/javascript", "application/javascript", + "text/html", "text/javascript", } { add(t, RenderForceDownload, CategoryText) } @@ -156,8 +163,10 @@ func LookupMIME(mime string) (MIMEEntry, bool) { // /