{
  "id": 16532202,
  "title": "`Content-Disposition` decides a filename, and the filename is where a download becomes a write",
  "url": "https://urgent.news/2026/10/25/content-disposition-decides-a-filename-and-the-filename-is-where-a",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-25T23:21:03.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/sorrelthorncroft/content-disposition-decides-a-filename-and-the-filename-is-where-a-download-becomes-a-write-2n3o"
  },
  "original_language": "en",
  "account": "Content-Disposition is a small header that decides both the filename and the download behavior. It communicates this decision in the HTTP response header, and the client follows it without further prompting. This header is crucial because it names the file and can force a download instead of rendering the content. The specifications define two dispositions: inline (suggesting display) and attachment (suggesting saving), both accepting a filename parameter. RFC 5987 and its successor outline how to encode non-ASCII characters in these parameters. Implementations must handle two parameter forms, an encoding declaration, and a quoting rule, managing cases where clients understand one form but not the other. When a browser downloads a file, it saves it based on the provided filename. This process can become a vulnerability if the application, not the user, writes the file. Two cases arise: server-side export jobs, where a server derives a filename from a request parameter, and file imports, where uploaded files use the header to derive stored names. An absence of Content-Disposition on download responses can also lead to vulnerabilities. Browsers might render certain content types as HTML, leading to script execution if the filename contains dangerous characters. To mitigate these risks, servers should sanitize filenames using an allowlist, generate server-generated identifiers for file storage, serve user content from separate origins, and explicitly set Content-Disposition on every download route. Logging the generated filenames alongside request identities aids in tracking and reviewing potential security incidents.",
  "summary": "Content-Disposition decides a filename, and the filename is where a download becomes a write Every browser download ends with a decision about what to call the file and what to do with it. The server communicates that decision in a response header, and the client acts on it without further prompting. Content-Disposition is a small header with a surprisingly long reach: it names the file, it can…",
  "key_points": [
    "Content-Disposition header determines filename and download behavior",
    "Inline disposition suggests display, attachment suggests saving",
    "Proper handling crucial to prevent security vulnerabilities"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}