Repository navigation
[ENG-19305] fix(media): deliver macro-enabled Office documents in chat - #179
Conversation
Sending a macro-enabled workbook fetched by the agent failed with a generic "Media failed." notice, and no attachment reached the customer. The host-local media validator allowlisted the non-macro OOXML document types only, so a byte-verified .xlsm was refused as an unsupported type. Macro-enabled Office files are ordinary deliverables in estimating workflows, and the sniffed MIME already proves the package shape before the allowlist is consulted. Refusing them added no protection while blocking the customer's requested file. Allow the seven buffer-verified macro-enabled Office MIME values for host-local sends and map their extensions in the shared MIME table so outbound filenames stay correct. The validator keeps rejecting opaque or generic-archive bytes that merely carry a macro-enabled extension. Link: https://linear.app/getboon/issue/ENG-19305
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
|
/cr |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Smoke verificationVerified against the exact file from the customer report ( Before and after, same machine, same file. The previous behavior came from a detached worktree at the base branch: {"build":"pre-fix","file":"real.xlsm","outcome":"BLOCKED","code":"path-not-allowed","message":"Host-local media sends only allow buffer-verified images, audio, video, PDF, Office documents, archives, and validated plain-text documents (got application/vnd.ms-excel.sheet.macroenabled.12)."}
{"build":"fixed","file":"real.xlsm","outcome":"DELIVERED","contentType":"application/vnd.ms-excel.sheet.macroenabled.12","bytes":6084709}The blocked message is character-for-character the message observed on the affected host during the incident. The delivered buffer length equals the size on disk, so nothing is truncated. All seven macro-enabled formats load with their matching type: No regression on the common path. Real No new spoofing surface. Four disguised files were probed under a macro-enabled extension and under the long-standing non-macro extension, then again on the base build: {"file":"neg-png.xlsm","outcome":"ACCEPTED","contentType":"image/png"}
{"file":"neg-png.xlsx","outcome":"ACCEPTED","contentType":"image/png"}
{"file":"neg-plain.xlsm","outcome":"ACCEPTED","contentType":"application/vnd.ms-excel.sheet.macroenabled.12"}
{"file":"neg-plain.xlsx","outcome":"ACCEPTED","contentType":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}
{"file":"neg-opaque.xlsm","outcome":"REJECTED","code":"path-not-allowed"}
{"file":"neg-opaque.xlsx","outcome":"REJECTED","code":"path-not-allowed"}
{"file":"neg-empty.xlsm","outcome":"REJECTED","code":"path-not-allowed"}
{"file":"neg-empty.xlsx","outcome":"REJECTED","code":"path-not-allowed"}Both extensions behave identically, and identically to the base build. Opaque binary and empty files are refused. Two cases are accepted by pre-existing loader behavior that is unrelated to this change and applies equally to non-macro Office extensions:
Both predate this change and are noted only for completeness. Not covered: no live host was used, since the affected instance runs a published build. The Note on the failing |
Correction to the smoke evidence aboveAn independent re-run found one wrong line in my earlier comment. Correcting it here rather than editing the original. What was wrong. I claimed the base build produced identical output for all eight disguised-file probes. For one fixture, a plain ZIP renamed with a macro-enabled extension, the content type differs: {"build":"pre-fix","file":"plain-zip.xlsm","outcome":"DELIVERED","contentType":"application/zip"}
{"build":"fixed","file":"plain-zip.xlsm","outcome":"DELIVERED","contentType":"application/vnd.ms-excel.sheet.macroenabled.12"}Why my first measurement was wrong. The probe imported the base-build loader from a detached worktree whose Why the conclusion still holds. The accept-or-reject outcome is identical on both builds for every negative fixture: {"build":"pre-fix","file":"real.xlsm","outcome":"REJECTED","code":"path-not-allowed"}
{"build":"pre-fix","file":"png-renamed.xlsm","outcome":"DELIVERED","contentType":"image/png"}
{"build":"pre-fix","file":"png-renamed.xlsx","outcome":"DELIVERED","contentType":"image/png"}
{"build":"pre-fix","file":"plain-zip.xlsm","outcome":"DELIVERED","contentType":"application/zip"}
{"build":"pre-fix","file":"plain-zip.xlsx","outcome":"DELIVERED","contentType":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}
{"build":"pre-fix","file":"opaque.xlsm","outcome":"REJECTED","code":"path-not-allowed"}
{"build":"pre-fix","file":"opaque.xlsx","outcome":"REJECTED","code":"path-not-allowed"}
{"build":"pre-fix","file":"empty.xlsm","outcome":"REJECTED","code":"path-not-allowed"}
{"build":"pre-fix","file":"empty.xlsx","outcome":"REJECTED","code":"path-not-allowed"}No fixture flipped from rejected to accepted. The plain ZIP was already deliverable before this change; only its label changed, because the macro-enabled extension now has an entry in the shared extension table and no longer falls back to the sniffed archive type. Risk Low: a plain ZIP carrying an Office extension is now labelled as an Office document downstream instead of an archive. It does not change what can be sent. Additional checks from the independent re-run
|
There was a problem hiding this comment.
LGTM. Tight, targeted fix. The allowlist expansion is safe because it sits after file-type verifies the package bytes — a .xlsm still has to prove it is a real macro-enabled OOXML package, and the disguised-binary test locks that in. Extension map additions keep outbound filenames correct when derived. Regression tests were authored to fail against prior behavior before the fix, which is the right order. All 90+ checks green, CodeQL neutral (expected). No config change, no impact to other file types. Ship it.
|
/cr |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Version-bump-only release cutting the three commits merged to boon since v2026.6.11-boon.32: #177 (ENG-19233), #178, and #179 (ENG-19305). #179 is customer-blocking: a macro-enabled Office file the agent produced or downloaded was dropped by the host media allowlist, so the chat showed "Media failed." while the assistant text claimed the file was attached. The estimating templates are macro-enabled, so their workbook output always took the failing path. The fix is on boon but no fleet host can run it until a tagged release exists. Bumps the gateway plus @openclaw/slack, @openclaw/msteams, and @openclaw/diagnostics-prometheus to 2026.6.11-boon.33 in lockstep across all 8 manifests, and adds the CHANGELOG entry. No code changes. The security-fast failure is unrelated to this release: four HIGH fast-uri advisories were published upstream about an hour before the run, and the same audit passes on every earlier PR in this stack. No dependency changed here.
…nflicts) 5 feature/fix commits (boon.32, boon.33): confirm-before-act on ambiguous requests (#175), unclosed content-block detection at stream finalization (ENG-19233, #177), >384MB PDF handling (#178), macro-enabled Office document delivery (#179), cron failure-destination recipient validation (#181). All conflicts were the established package.json/npm-shrinkwrap.json version-string pattern (kept 2026.6.34-boon.1), plus a new one this round: origin/boon still pins fast-uri at 3.1.6 across pnpm-workspace.yaml, pnpm-lock.yaml, and four npm-shrinkwrap.json files (root, acpx, lobster). This integration branch already carries a deliberate 4.1.2 override from the original 2026.6.34 sync (documented in the PR description's "Dependency / security pins" section: the bump was needed because upstream's 6.34-era code targets fast-uri's 4.x API, not because it's numerically newer) -- the same "boon hasn't caught up to a pin this branch already needed" situation as the `tar` override in that same section. Kept 4.1.2 everywhere. Verified: pnpm tsgo:core:test + tsgo:extensions:test both clean. Targeted tests across every touched surface (pdf-tool, web-media, mime, cron delivery-target-validation + cron.validation, anthropic-transport-stream, concise-interaction-overlay, embedded-agent-helpers, amazon-bedrock stream runtime, anthropic prompt-overlay, document-extract) -- 303 passing, 0 failures. One unrelated pre-existing failure noted and left alone: src/gateway/mcp-http.test.ts's "withdraws a closing runtime before drain without fencing its successor" fails deterministically in this sandboxed environment with a raw ECONNRESET on a real loopback TCP socket -- neither mcp-http.ts nor its test file were touched by this merge, so this is an environment/network-sandboxing artifact, not a regression from this change.
Related: ENG-19305
What Problem This Solves
Fixes an issue where users who ask the agent to send back a macro-enabled Office file would receive no attachment and a bare "Media failed." notice in chat, when the file is a
.xlsm,.docm,.pptm, or another macro-enabled Office format.The affected surface is outbound file delivery from an agent turn to any chat channel. Plain
.xlsx,.docx, and.pptxfiles were unaffected and delivered normally, which made the failure look random to the customer. Macro-enabled workbooks are common deliverables in estimating workflows, so the agent could fetch the customer's own file and then fail to hand it back.Why This Change Was Made
Host-local media sends validate the sniffed content type against an allowlist of document formats. That allowlist covered the non-macro Office family only, so a genuine macro-enabled workbook was classified as an unsupported type and dropped before any upload was attempted.
The allowlist is consulted after the package bytes are already identified, so admitting these formats does not weaken the check: the file still has to prove it is that Office format. Files that merely carry a macro-enabled extension, including opaque binary and plain archives, are still refused.
Extension mappings for the same formats were added to the shared MIME table so outbound filenames keep the correct extension when one has to be derived.
User Impact
Customers can now receive macro-enabled Office files the agent produced or fetched, in the same way non-macro Office files already worked. There is no configuration change and no change for any other file type.
Evidence
Regression tests were added first and failed against the previous behavior:
Failure message before the change:
After the change:
Negative coverage is included: opaque binary named
.xlsmand a plain ZIP named.xlsmboth remain rejected withpath-not-allowed.Summary by cubic
Fixes ENG-19305: host-local media sends previously rejected byte-verified macro-enabled Office files and showed “Media failed”; these files now deliver as attachments. Renamed or invalid files remain rejected.
.xlsm,.xltm,.docm,.dotm,.pptm,.potm, and.ppsm.Written for commit 08ebe32. Summary will update on new commits.