fix(buzz-cli): expand upload MIME allowlist to match relay's generic file path - #6364
Open
shawnhank wants to merge 1 commit into
Open
fix(buzz-cli): expand upload MIME allowlist to match relay's generic file path#6364shawnhank wants to merge 1 commit into
shawnhank wants to merge 1 commit into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
buzz upload file/buzz messages send --filerejected PDFs, Office documents, archives, and plain text client-side before the request ever reached the relay —ALLOWED_MIMESonly listed 4 image types +video/mp4.validate_file_contentinbuzz-media) already accepts anything not on itsBLOCKED_FILE_MIME_TYPESdenylist (active web content, executables) — the CLI's stricter allowlist was purely a client-side gap. Verified server-side behavior by readingcrates/buzz-media/src/validation.rsdirectly.MAX_FILE_BYTES) for the generic path, matching the relay'sdefault_max_file_bytes. Previously non-video files were checked againstMAX_IMAGE_BYTES(50 MB) regardless of type.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) andupload_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— cleancargo fmt -p buzz-cli