fix(cli): align buzz upload file MIME check with relay policy (#2963)
Problem
buzz upload file applies a client-side MIME allowlist (ALLOWED_MIMES — 5 image/video types) that is stricter than the relay it uploads to. The generic PUT /upload route the CLI targets validates content with a denylist (BLOCKED_FILE_MIME_TYPES in buzz-media), which accepts PDFs, zip-backed OOXML (.xlsx/.docx), CSVs, and other generic files. So the client refuses files the server would happily accept, and agents can't attach documents the desktop can.
Repro (before this change):
$ buzz upload file --file report.xlsx
error: unsupported file type: application/zip # an .xlsx sniffs as zip; the relay accepts it
Closes #2963.
Fix
- Replace the CLI allowlist with a mirror of the relay's
BLOCKED_FILE_MIME_TYPESdenylist (14 entries: active web content + native executables/installers), extracted into a small, unit-testablecheck_upload_mime(). Everything not on the denylist is sent to the relay, which remains the authority on acceptance (images/video via dedicated pipelines, generic files via the denylist). The client now fast-fails only on the permanent security denylist, so it can never again reject something the server accepts. - Raise the non-media size cap from the 50MB image ceiling to 100MB (
MAX_FILE_BYTES), matching the relay's defaultmax_file_bytes(buzz-media/src/config.rs). Without this a 60MB PDF would pass the MIME check and then be wrongly rejected by the old image cap — re-breaking the exact files this issue is about. Image (50MB) and video (500MB) caps are unchanged. - Add a reciprocal keep-in-sync note on the relay-side const.
buzz-clideliberately does not take abuzz-mediadependency (would drag S3/image/mp4 deps into the CLI binary for a 14-string list); the two lists are mirrored with cross-referencing comments.
Tests
New unit tests in crates/buzz-cli/src/client.rs:
upload_mime_check_allows_types_the_relay_accepts— pdf, zip (xlsx/docx), gzip, csv, octet-stream, plus image/video all pass.upload_mime_check_rejects_relay_blocked_types— html, svg, javascript, and executables still rejected.
cargo test -p buzz-cli # 252 passed (incl. the 2 new)
cargo test -p buzz-media # 103 passed
cargo fmt --all -- --check # clean
cargo clippy -p buzz-cli -- -D warnings # clean
Status note (2026-08-07): this branch is ~300 commits behind main and currently CONFLICTING.
The bug is still real on main (ALLOWED_MIMES is still the 5 image/video types). There is now a crowd of open PRs for the same problem; several are already mergeable, including #4298 (relay-as-authority framing, close to this PR's intent).
I'm not rebasing this one into the stampede. If a relay-authority / denylist-style fix lands first, I'll close this as superseded. If maintainers specifically want the denylist-mirror + 100MB size-cap approach here, say so and I'll rebase.