Attachment Writes Are a Trust Boundary

Attachment writes are a trust boundary

Attachments look boring because they are "just files." That is exactly why they are dangerous. A file write turns parsed remote input into a local artifact with a path, name, permissions, opener behavior, and future meaning to other programs.

In mxr, the attachment path crosses several trust boundaries at once:

So the safety rule is simple: an attachment write is not done when the bytes are written. It is done when the path, name, permissions, size, and opener boundary are all boring.

The checklist

This is not only about malicious email. It is also about boring accidents: a filename that works on macOS but breaks on Windows, a shared host where 0644 leaks a private PDF, or a client bug that tries to save into ~/.ssh.

What mxr now does

Validated against code on 2026-05-28:

2026-06-24 follow-up: cache filenames now always include the attachment id. That
closes the quiet collision case where two safe-looking attachments share a name,
and it keeps weird remote names like ., .., or CON.txt boring after
sanitization. The user-visible filename remains metadata; the cache path is a
private local artifact.

See also