Commit Graph
7 Commits
Author SHA1 Message Date
Linus Rath fb3affb452 test: give the HTML reading time checks room on a busy machine 2026-11-02 23:40:32 +01:00
Linus Rath 4356ccadb7 fix: load the attachment readers only when needed and read two files at a time at most 2026-11-02 23:37:34 +01:00
Linus Rath 774aeeb313 fix: read PDF attachments only as far as needed, with a time limit and no scripts 2026-11-02 23:31:47 +01:00
Linus Rath 3e6686f700 fix: read Office attachments in their own order, text boxes once and dates as dates 2026-11-02 23:29:04 +01:00
Linus Rath 7013a8cf52 fix: read HTML and calendar attachments in time with their size, without alarm texts 2026-11-02 23:24:34 +01:00
Linus Rath 7c97eb2691 fix: keep attachment text reads within their size and character limits
Every reader now stops at the read's character budget, a cell at 4,000
characters, one Office XML part at 12 MB, and parts with a DTD are
refused. A compound file named .docx is encrypted only when it holds an
EncryptedPackage stream, else unsupported; .eml files are unsupported
instead of raw MIME; maxChars that isn't a number falls back to 20,000.

attachment-text.test.ts: the zip bomb test passes the cap as an option
now, and a bare compound file named secret.docx is expected unsupported
(it is a legacy file under a new name; limits.test.ts covers the
password-protected one).
2026-11-02 23:10:51 +01:00
Linus Rath bda99e1df8 feat: let plugins read the text of attachments
api.email.getAttachmentText reads PDF (pdf.js), Word, Excel, PowerPoint
and OpenDocument files (own reader over fflate and DOMParser, unpacking
capped at 50 MB), text, CSV, HTML, calendar and address files, and
answers with a status for what it can't read. The extraction lives in
lib/attachment-text so Files can use it too.

The sandbox runtime now copies every flag the host sends into
api.host.features; before, it kept only the three core flags, so the
assistant's flags never reached a plugin. The host bridge assertions in
plugin-host-features.test.ts compare against the core flags plus the
assistant's (withAssistant), since the init payload and host-change now
carry attachmentText too.
2026-11-02 21:53:05 +01:00