vaha_
FR Français
← Index No. 18 / 21

Dossier · Open source · mail security

mailxray

Attachment inspection

A service that looks inside untrusted mail attachments without opening them: a Rust workspace of two crates, an analysis library and a daemon with HTTP routes. It reads PDF, Office documents and archives structurally, hunts for active content and macros, and answers with a verdict and a reason code. Archives are unpacked by 7-Zip inside a bubblewrap sandbox, and reports are addressed by the blake3 hash of the content, so one file is inspected once for every recipient.

Domaine
Open source · mail security
Années
2026
État
en cours
Système
Server · Web
mailxray — Attachment inspection
Capture · No. 18 mailxray — verdict, reason and archive contents, without opening the file.

Ce qu'il fait

01 / 09
  1. Type from magic bytes, never the extension; a mismatch is reported
  2. PDF: actions and JavaScript in nested dictionaries, escaped names, a deep pass over compressed streams
  3. OOXML and OLE: macros, external links and hidden sheets, before the generic ZIP handler
  4. Archives: content tree, compression ratio and protection against bombs
  5. 7-Zip inside a bwrap sandbox: no network, no /home, read-only system binds, timeout and output cap
  6. Reports keyed by the blake3 hash of the content, one inspection for every recipient
  7. A clear JSON contract (schema 1) with reason codes and default policy
  8. Never "clean" for a file that was not fully inspected: caps yield partial or suspicious
  9. A reference card in the browser and a demo, with no calls out to the service

Couches

02 / 03

Core — analysis

Rustlopdfzipquick-xml
  • Type detection and a check that magic matches the name
  • PDF: recursive walk over action dictionaries, depth capped at eight
  • OOXML: package, macros and links; OLE: streams and macro payloads
  • Archives: 7-Zip listing with a tree and compression ratio
  • The policy layer turns findings into a verdict and reason codes

Daemon

axumbwrap7-Zipblake3
  • Routes /inspect, /entry, /report and /health, a loopback service with no auth
  • Sandbox: --unshare-all, read-only binds, one writable work directory
  • Single-member extraction only for inert types, capped at 8 MB
  • Reports cached on disk, keyed by the content hash

Contract

JSON schema 1SPEC.md
  • The spec comes before the code: report fields, reason codes, policy
  • The webmail never calls the service directly, its backend proxies /inspect and /entry
  • The milter is not shipped yet: integration means calling /inspect or embedding the crate

Technologies

03 / 03
Langages RustTypeScriptShell 03
Frameworks et outils axumlopdfzip7-Zipbubblewrapblake3 06
Infrastructure Loopback servisbwrap 02

Tous les systèmes au dossier

Retour à l'index →