buzz icon indicating copy to clipboard operation
buzz copied to clipboard

feat(buzz-cli): expand upload ALLOWED_MIMES to match relay generic file path

Open bigshezhang opened this issue 4 months ago • 5 comments

Problem

buzz-cli (the agent-first CLI) restricts uploads to only 5 MIME types:

// crates/buzz-cli/src/client.rs
const ALLOWED_MIMES: &[&str] = &[
    "image/jpeg",
    "image/png",
    "image/gif",
    "image/webp",
    "video/mp4",
];

Any other file type is rejected client-side with "unsupported file type: {mime}" before the request ever reaches the relay.

However, the relay server (crates/buzz-media/src/validation.rs) already supports a generic file upload path that accepts PDF, Office documents, archives, audio, and most other formats — only blocking active web content (HTML/JS/SVG) and native executables for security.

This means:

  • Human users (Desktop client) can upload arbitrary files via the Tauri media commands.
  • Agents (via buzz upload file / buzz-cli) cannot upload anything beyond images and MP4 video.

Impact

Agents running through buzz-acp + buzz-cli cannot share documents, spreadsheets, PDFs, audio files, or archives in channels — a capability that human users already have. This is a functional gap between human and agent surface area, which contradicts the "agents are members, not bots" design principle.

Suggested fix

Expand ALLOWED_MIMES in buzz-cli/src/client.rs to align with the relay's generic file path validation logic. Two options:

  1. Mirror the relay blocklist approach: allow all types except BLOCKED_FILE_MIME_TYPES (HTML, JS, SVG, executables). This keeps the CLI in sync with relay policy automatically.
  2. Explicit allowlist expansion: add common document/archive/audio MIME types (application/pdf, application/zip, audio/*, Office formats, etc.) to the existing list.

Option 1 is preferable since it avoids maintaining two divergent allowlists.

Additional context

  • The relay's file_mime_to_ext() in validation.rs already maps ~30+ MIME types to extensions for the generic path.
  • Size limits may need a third tier (currently 50 MB images / 500 MB video); a reasonable default for generic files would be 100–200 MB.
  • The serve_inline() function already handles the rendering distinction: images/video inline, everything else as attachment download cards.

Environment

  • buzz-cli extracted from Buzz Desktop v0.4.26 .deb
  • Relay: ghcr.io/block/buzz:main (self-hosted, compose deployment)
  • Agent: buzz-acp + buzz-agent running as a systemd service

bigshezhang avatar Jul 27 '26 05:07 bigshezhang

Adding a concrete repro from the Buzz document-worker spike because this is now on the critical path for agent-produced document previews/edits.

Environment:

  • Buzz CLI binary: /Applications/Buzz.app/Contents/MacOS/buzz
  • buzz --version: not exposed; command fails with unexpected argument --version
  • OfficeCLI: 1.0.143
  • Git: 2.50.1 (Apple Git-155)
  • Relay: space-cowboy.communities.buzz.xyz

Repro commands from an agent workspace:

buzz upload file --file RESEARCH/OFFICECLI_DOCUMENT_SPIKE_FIXTURES/Custom_AI_Toolmaker_Nate_St_Pierre_PUBLIC.pptx
buzz upload file --file RESEARCH/OFFICECLI_DOCUMENT_SPIKE_FIXTURES/buzz-document-workbench-original.docx
buzz upload file --file RESEARCH/OFFICECLI_DOCUMENT_SPIKE_FIXTURES/Monthly_budget.xlsx

Observed results:

unsupported file type: application/vnd.openxmlformats-officedocument.presentationml.presentation
unsupported file type: application/zip
unsupported file type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

Expected result: buzz upload file should accept common Office document types so an agent can attach original or edited .pptx, .docx, and .xlsx files back into the channel. PNG preview upload works today, but the edited Office file itself cannot currently be delivered through Buzz from the CLI.

Why it matters for this workflow: the document worker can render real PPTX/XLSX previews now, but editor support is blocked because an edit produces a new Office file and the CLI cannot upload it.

tmoody1973 avatar Aug 02 '26 20:08 tmoody1973

Still the case on main @ e9269cb: the relay's generic file path (validate_file_content) accepts STL/3MF/ZIP/STEP up to BUZZ_MAX_FILE_BYTES, but buzz upload file and buzz messages send --file still stop at the client with unsupported file type: application/octet-stream / application/zip because of ALLOWED_MIMES in crates/buzz-cli/src/client.rs::upload_file. We run a locally patched CLI with that check and the MAX_IMAGE_BYTES/MAX_VIDEO_BYTES cap removed from upload_file and the relay accepts everything fine. A simple fix would be to keep the image/video validation for those MIME families only and let every other type through to the relay, which already enforces its own deny-list and size limits.

nachumi-a2zoperations avatar Oct 09 '26 12:10 nachumi-a2zoperations

In our managed environment, buzz upload file attempts for PDF and ZIP are rejected with unsupported file type. The local Buzz 0.5.26 source shows that the CLI still applies a JPEG/PNG/GIF/WebP/MP4 allowlist before upload, while the relay and Desktop Tauri code have a generic-file path for safe document/archive attachments. So the immediate failure appears to be in the CLI path, and our request is that the fix reaches the hosted release consistently.

Our school workflow needs PDF, DOCX, and ZIP as message attachments for human Desktop users and CLI agents. Please ensure the full deployed path supports those types, retains the original filename, and delivers them as downloadable file cards.

ahmetertem06 avatar Oct 15 '26 14:10 ahmetertem06

Still reproducing on Buzz 0.5.28 (macOS), and this is now our most urgent blocker.

Our school staff can't exchange Excel, Word, PDF or ZIP files in Buzz. Those are the everyday formats for timetables, transport rosters, contracts and official letters, so people go back to email and WhatsApp to send them.

Repro with the bundled CLI on 0.5.28 (minimal valid files):

buzz upload file --file t.pdf   -> unsupported file type: application/pdf
buzz upload file --file t.docx  -> unsupported file type: application/zip
buzz upload file --file t.xlsx  -> unsupported file type: application/zip
buzz upload file --file t.zip   -> unsupported file type: application/zip

Note that DOCX and XLSX are sniffed as application/zip, so they fail too. Any allowlist fix needs to cover the OOXML types, not only PDF and ZIP.

Please treat XLSX, DOCX, PDF and ZIP as downloadable file cards that keep the original filename, in both Desktop and the CLI. Umbrella: #8366.

ahmetertem06 avatar Oct 16 '26 09:10 ahmetertem06

This is also affecting our internal team. We have a significant amount of reporting and content that we'd like our agents to generate and share on a weekly basis, much of which is best suited to PDF format.

Currently, the agent can take a snapshot of the first page and upload it, but that only captures a small portion of the content as an image. Ideally, we'd like the agent to be able to share the complete PDF as an attachment so that the entire document is available for review.

Supporting PDF attachments would make a meaningful difference in our ability to automate these recurring reporting workflows.

skenway avatar Oct 20 '26 20:10 skenway