Skip to content

tmpmail 0.3.5

Latest

Choose a tag to compare

@github-actions github-actions released this 13 Nov 12:05
· 3 commits to main since this release

tmpmail 0.3.5 fixes the command-line tool and the shared core: cleaner sender text, read --html with the Firefox snap, inline images from mail.tm, image addresses listed as links, and long mail cut by the provider without a word. It also brings the fixes of a full security review of the code, and waits through provider rate limits.

Fixed

  • Stronger cleaning of the sender's words. Terminal escape sequences are now removed whole (ESC[31mRED printed as [31mRED before; now RED), and besides control characters and bidi overrides, the other invisible format characters go too (U+061C, zero-width spaces, word joiners, the BOM). Zero-width joiners and the tags of emoji flags stay, so emoji still draw as one. A stray ESC goes alone, without the letter after it. This is render::clean and render::clean_line, used by ls, read, watch, the TUI and the desktop app.

  • read --html works with the Firefox snap on KDE. With the Firefox snap, Firefox showed "Access to the file was denied": the copy was written under ~/.local/state/tmpmail/view/, and a snap can't read hidden folders in your home (GNOME got around it by handing the file over through the document portal; KDE doesn't). When the browser that opens the copy is a snap (by --browser, $BROWSER, or the desktop's default for HTML files), tmpmail now writes it to ~/snap/NAME/common/tmpmail-view/, which the snap can always read, still private (0600 in a 0700 folder) and deleted after a day. A snap that has never run has no such folder yet, and tmpmail creates none for it: the copy then goes to the state folder and is handed to the snap with gio launch and its desktop file, which passes it through the document portal, with a warning to start the browser once and run the command again if it still refuses the copy. Without gio or the snap's desktop file the copy is opened from the state folder as before, and the warning says so (and why) instead of naming the portal. The TUI's o does the same.

  • Inline images show in read --html. The copy kept cid: references, which a browser can't load, so inline images (logos, pictures in the text) showed as their alt text. They are now put in the copy as data: URLs: the attachment the provider lists under that name, else the part with that Content-ID in the raw message, where the provider has one (mail.tm, mail.gw, DropMail, Maildrop). mail.tm and mail.gw rewrite an inline image's cid: address in the HTML they hand out to attachment:ID, the id of the attachment they list for it, which no browser knows: tmpmail now reads an image's src="attachment:ID" as the message's own image attachment with that id (only that scheme, only that message's attachments, under the same limits), and --json read shows it as cid:ID. The raw message of mail.tm also leaves out the line break after each part's opening boundary, which the MIME reader now accepts (a boundary followed at once by a Content- header and its colon; nothing else is loosened). Raster images only, up to 10 MiB each. The TUI's o puts them in its copy too, fetched on a thread of their own (the status line says "loading the message's inline images...", and says when some couldn't be loaded), so neither the screen nor the inbox checks wait on them.

  • Image addresses aren't links. A mail's remote images (<img src>, srcset, background=, CSS url(...)) were listed by links, and could be "the best link" of wait --link or the first link of the TUI's L/O and the desktop app: a mail with images and no link at all offered a Google logo. An address the HTML only loads is now left out, also when the text part repeats it, unless the mail also links to it.

  • Long mail from mail.tm isn't cut short. mail.tm and mail.gw cut a message's text and HTML at 100 KiB, mid-line and without a word, so read showed part of a long mail, and a code or link past the cut wasn't found. A body that long is now checked against the raw source, which is whole, and the source's is used. If the source can't be read, the text ends with a note that it may be cut and that read --raw has all of it.

  • wait waits through a rate limit. With the desktop app or the TUI checking the same mail.tm inbox, wait --link exited 3 with "rate limited, try again later" when its first listing was refused. wait, otp --wait and watch now say so once and keep waiting: they ask again after the provider's Retry-After (at most 2 minutes), else after one or two poll intervals, until their own timeout (exit 2), and push wake-ups wait too. Mail that arrives while the first listing is refused counts as new by its date. The desktop app's and the TUI's checks hold back after a rate limit the same way, so they don't keep the provider refusing a wait on the same inbox.

  • In-page links in read --html find their target. href="#section" was kept, but the sanitizer dropped the id and <a name> it points at, so only #top worked. They are kept now, prefixed with mail- so a mail can't reuse a name of the page's own, and the mail's # links are rewritten to match (# stays, and so does #top unless the mail has its own top). The same sanitizer (render::sanitize_mail_html) serves the desktop app.

  • Headers labelled ISO-8859-1 are read as Windows-1252, as browsers do (tempmail.lol's encoded names and subjects): curly quotes and dashes in mislabelled mail show instead of being dropped as control characters.

Security fixes

From a full security review of the code at 0.3.4 (2026-11-01). None was critical or high.

  • A "link" must be a real web address (medium). A mail could put href="http\..\..\Windows\System32\calc.exe" or href="http/../Downloads/verify.html" in a message: the link check only looked at the first four letters, the word "verify" ranked it first, and links --open or the TUI's O handed it to the system opener, which took it for a file path (GNOME's gio open resolves it against the current folder; Explorer starts an executable it is given). A link is now read as a browser reads it (character references decoded, line breaks dropped, spaces and invisible characters escaped) and must then be a whole absolute http:// or https:// URL with a host, without backslashes; links --open and O refuse anything else whatever the list holds. So the TUI's L no longer copies a link with a line break in it, which would run as a second command when pasted in a shell. A link written with &#38; instead of &amp; now works, and an invisible mark right after a link in right-to-left text ends it. The MCP server's get_links and the desktop app take the same list.

  • A snap can't make read --html delete or write files elsewhere (medium). The copies for a snap browser go to ~/snap/NAME/common/tmpmail-view/, which the snap may write in. tmpmail checked that no folder on the way was a link and then worked by path, so a snap swapping its folder for a link at the right moment could make tmpmail delete a file of the same name in another folder (a race the review won in a few views), or create the copy where the link pointed. The folder is now opened one level at a time inside the one before it, refusing links, and the copy is written, listed and deleted inside the open folder only, so a link put there afterwards leads nowhere. If a folder on the way is a link, the copy goes to the state folder with a warning. Copies are now named tmpmail-ID.html, and in a snap's folder only such files (and the ID.html copies of the first builds that wrote there) are pruned, in every snap's tmpmail-view folder through the same open-folder walk, so an earlier browser's copies go too.

  • Dependencies with published advisories updated (medium). rustls 0.23.46 and rustls-webpki 0.103.16 (a certificate chain through the distrusted emSign intermediates, whose keys are public, was accepted where the system still trusts their roots; an unauthenticated ServerHello could downgrade later connections' key exchange), ammonia 4.2.4 (CSS url matched case-sensitively; not reachable with tmpmail's settings), tokio 1.53.3, rustix 1.1.6 (its extended-attribute functions, which tmpmail doesn't call, could mark unwritten bytes as read). A new audit workflow checks Cargo.lock against the RustSec database on every push and every week; the advisories without a fix within semver are listed in deny.toml with their reasons (lru 0.12 through ratatui 0.29, and unmaintained helper crates).

  • Inline images are capped per message (medium, in the desktop app; the same in read --html). A mail with one 9 MB image and a thousand <img src="cid:big.png@N"> tags made the app download the image a thousand times and keep a copy for each name (about 9 GB). Images are now kept by the attachment they resolve to, so any number of names for one attachment fetch it once; at most 64 distinct cid: names are looked up per message, and at most 25 MiB of images are shown for it (64 is far more inline images than real mail carries; 25 MiB is the usual limit of a whole mail at the big mail services). read --html fetches each attachment once too, and its copy holds at most 25 MiB of images however often the mail repeats one.

  • The release workflow is locked down (medium). release.yml, which builds the CLI's archives and pushes the Homebrew formula, used actions by tag (and dtolnay/rust-toolchain by branch) while holding write, attestation and tap-token rights; a moved tag upstream could have attested or published a different binary. Every action in every workflow is now pinned by commit SHA, checkouts keep no credentials, the jobs that compile have a read-only token, and the attestations (of each archive and of SHA256SUMS) are made in the release job, which compiles nothing. The Homebrew tap token is given to the git push alone. A manual run of the workflow, even on a tag, now only builds (before, it published the release and pushed the formula). The ci, gui and providers workflows get a read-only token; only the provider check's report job may write issues.

  • save never writes through a planted link, and names are safe everywhere. save checked that a name was free and then wrote it, following links: another user who can write in the -o folder could plant a dangling link named like an expected attachment and have its bytes written wherever it pointed. Each file is now created new (O_EXCL, and O_NOFOLLOW on Unix), moving on to name (1).ext when the name is taken. Names now also lose a leading - (which rm * or tar * would read as an option) and trailing dots and spaces; Windows device names (CON, NUL, COM1.pdf...) get a _ in front, so the bytes don't go to the console or vanish into NUL; and a long name is cut at 240 bytes keeping its extension (before, 200 characters, which could pass the file system's 255 bytes and fail). The desktop app's drag-out files are created new the same way.

  • A stricter HTML sanitizer. Relative, //host and \\host links and images are dropped: mail has no base address, and from the file: page of read --html such a link resolves to another machine (on Windows an SMB connection that can leak the user's password hash). data: URLs stay only as an image's raster picture, never as a link (a page of the sender's) or an SVG. Inline styles keep only an allowlist of look-and-layout properties in every mode (colors, fonts, spacing, borders, sizes, table and flex layout; not position, inset, z-index, transform, scale, zoom, opacity..., and no negative margins), with comments removed and a declaration holding a CSS escape dropped, so a link can't be laid over the whole mail to catch any click. The file view's style filter now reads CSS escapes before looking for url( (u\72l( was missed; the page's CSP still blocked it) and also blocks image-set(, @import and expression(; with --images, a style may load only web URLs and inline raster images. In-page # links still work.

  • --json output carries no raw terminal controls. serde_json escaped only U+0000–U+001F, so tmpmail --json read or --json watch on a terminal wrote a subject's 8-bit CSI or OSC controls (U+009B, U+009D: clear the screen, write the clipboard on some terminals) and bidi overrides as they were. Every control character, bidi control and invisible format character is now written as a \uXXXX escape, always (the values a parser reads are unchanged); the MCP server's replies too. domains now cleans the names a provider sends before printing them, as every other provider string already was.

  • Hostile mail can't stall tmpmail. A sender could make read, the TUI, wait --otp/--link, the MCP server or the desktop app work for seconds to minutes: 100 000 nested <div> took 40 s to sanitize; 560 KB of distinct numbers 10 s to search for a code, 1.4 MB of distinct links 8 s; a header of 40 000 MIME parameters 4 s; a subject of combining marks froze the TUI's footer. HTML past 4 MiB or nested deeper than 1000 elements (measured by the HTML parser itself, 16 KiB at a time, stopping once past the limit: a first, hand-written count took elements the parser closes on its own, such as a second <a> or SVG's <path/>, as open, so shallow mail was shown as text, and missed nesting the parser does build, such as <span><div></span> repeated) is now shown as its plain text, under a note saying why; codes and links are looked for in the first 1 MiB of text (4 MiB of HTML), cut at a space, with hash sets; a header's first 256 parameters are read (and boundary, charset, name, filename past them); and the footer is fitted in one pass. Tests time each case at the reviewers' sizes.

  • Limits on what a provider sends, and where credentials go. A provider's answer (or a man in the middle's) could be any size: a multi-GB body or an endless push-stream line grew until the system killed tmpmail. raw messages and attachments are now read up to 64 MiB (above the providers' own message limits), JSON answers up to 80 MiB (mail.tm and Maildrop send raw messages as JSON), error bodies up to 64 KiB, and mail.tm's push stream refuses a line over 1 MiB; past a limit the request fails with a clear error instead of reading on. A provider that stops sending in the middle of an answer is reported as "request timed out", as a provider that never answers is (it showed reqwest's own "operation timed out"). A download address that mail.tm or DropMail lists for an attachment or a raw message is now used only when it is on the provider's own site (same scheme, port and host, or a host under it), so the account's token (mail.tm) or the session (DropMail) never goes to another host.

  • Private files are written whole and exactly 0600 (info). state.json and DropMail's token cache are now written to a new temporary file next to them (created with O_EXCL and O_NOFOLLOW, mode set to 0600 whatever the umask) that then replaces the old one: a token cache that existed with a wider mode no longer keeps it, and a link put in its place is replaced, not followed.

  • The MCP server hands mail to agents more carefully. Mail is a prompt-injection channel: every string in a tool result now loses terminal escapes, control, bidi and invisible characters, Unicode tag characters included (the "ASCII smuggling" carrier, invisible to a person reading the transcript); fields over 64 KiB and lists over 200 items are cut ("truncated": true); the results that hold mail carry "untrusted_content": true and a second text block noting that the mail fields are data, not instructions; and create_inbox says in public_note when the inbox is public (Maildrop). The JSON-RPC loop no longer dies on a line that isn't UTF-8 (it answers -32700 and goes on), answers a batch with an array of replies (it got none before; a tools/call in a batch gets -32600), caps a line at 1 MiB and the calls running at once at 16 (a cancelled call counts until its thread has ended), and refuses a second call with the id of one still running (a cancelled call's id may be used again).

  • Saved attachments are marked as downloaded. On Windows save now writes a Zone.Identifier stream (zone 3) next to each file, and on macOS sets com.apple.quarantine, as browsers do, so SmartScreen, Office's Protected View and Gatekeeper treat a file from a mail as from the internet. No new dependency.

  • Install and verification instructions. The README's GitHub Actions snippet now downloads SHA256SUMS too and checks the archive against it before unpacking; the attestation commands add --signer-workflow (so a file attested by the desktop app's workflow doesn't pass for a CLI file, and the reverse); cargo install --locked builds with the vetted Cargo.lock. The desktop app's packageManager names pnpm with its hash (corepack checks the pnpm it downloads), and the app's builds in CI run tauri build with --locked.

For library users

  • Watcher::set_config keeps the poller (and its push streams) when the poll interval, push and timeout are unchanged.
  • extract::links no longer returns what the HTML only loads (images, url(...)). New: extract::push_new.
  • render::clean and render::clean_line remove more (see above); their signatures are unchanged.
  • New: provider::inline_images (a raw message's inline images by Content-ID), provider::inline_attachment (the listed attachment a cid: most likely means), provider::cid_of_url, provider::image_type (the raster type an inline part may be shown as; never SVG), provider::MAX_INLINE_IMAGE, render::cid_images and render::safe_html_document_inline (safe_html_document with cid: images replaced).
  • New: extract::is_web_link, the rule above; extract::links returns only such links.
  • New: provider::MAX_INLINE_CIDS and provider::MAX_INLINE_TOTAL, the limits above.
  • render::safe_filename also refuses Windows device names, a leading - and trailing dots and spaces, and caps names at 240 bytes.
  • New: render::escape_json_invisible, which escapes those characters in JSON text.
  • New: render::percent_decode, the %XX decoder the desktop app shares.
  • New: render::html_too_large, render::MAX_HTML, render::MAX_HTML_DEPTH and render::HTML_TOO_LARGE; past the limits, render::html_to_text and the sanitizer return the body's text without tags, after that note.
  • New: render::percent_encode is public.
  • New: store::mark_from_internet.