Skip to content

fix(buzz-cli): expand upload MIME allowlist to match relay's generic file path - #6364

Open
shawnhank wants to merge 1 commit into
block:mainfrom
shawnhank:fizz/expand-cli-upload-allowlist
Open

fix(buzz-cli): expand upload MIME allowlist to match relay's generic file path#6364
shawnhank wants to merge 1 commit into
block:mainfrom
shawnhank:fizz/expand-cli-upload-allowlist

Conversation

@shawnhank

Copy link
Copy Markdown

Summary

  • buzz upload file / buzz messages send --file rejected PDFs, Office documents, archives, and plain text client-side before the request ever reached the relay — ALLOWED_MIMES only listed 4 image types + video/mp4.
  • The relay's generic file-upload path (validate_file_content in buzz-media) already accepts anything not on its BLOCKED_FILE_MIME_TYPES denylist (active web content, executables) — the CLI's stricter allowlist was purely a client-side gap. Verified server-side behavior by reading crates/buzz-media/src/validation.rs directly.
  • Per both issues' suggested fix, mirrors the relay's blocklist approach instead of maintaining a second, divergent allowlist: recognized image/video MIME types keep their existing dedicated handling (size caps, relay pipelines); everything else passes the client-side check unless it's a recognized image/video/audio type (which the relay's generic path also fails closed, since audio has no dedicated pipeline yet) or on the denylist.
  • Adds a third size tier (100 MB, MAX_FILE_BYTES) for the generic path, matching the relay's default_max_file_bytes. Previously non-video files were checked against MAX_IMAGE_BYTES (50 MB) regardless of type.
  • Slightly improved the rejection error message, since the old wording ("unsupported file type") was misleading for types the relay's denylist has always accepted.

Fixes #2963, fixes #3083.

Test plan

  • cargo test -p buzz-cli — 352 passed, including two new tests: upload_accepts_pdf_via_generic_file_path (PDF magic bytes now succeed against a mock relay) and upload_rejects_recognized_audio_type (audio is still rejected client-side, before any network call, since the relay's generic path fails it closed too)
  • cargo clippy -p buzz-cli --all-targets -- -D warnings — clean
  • cargo fmt -p buzz-cli

…file path

buzz upload file / --file rejected PDFs, Office documents, archives, and
plain text before the request ever reached the relay: ALLOWED_MIMES only
listed 4 image types + video/mp4, while the relay's generic file-upload
path (validate_file_content in buzz-media) already accepts anything not
on its BLOCKED_FILE_MIME_TYPES denylist (active web content, executables).

Mirror the relay's blocklist approach instead of maintaining a second,
divergent allowlist: known image/video MIME types keep their existing
dedicated handling, everything else passes through unless it's a
recognized image/video/audio type (which the relay's generic path also
fails closed) or on the denylist. Adds a third size tier (100 MB) for the
generic path, matching the relay's default max_file_bytes.

Fixes block#2963, fixes block#3083.

Signed-off-by: Shawn Hank <shawn@shawnhank.com>
@shawnhank
shawnhank requested a review from a team as a code owner August 20, 2026 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant