block / block/buzz

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

Open
#3,083 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
32.7k
Forks
4.3k
Avg merge
1d 13h
Merged PRs (30d)
253

Description

## Problem

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

```rust
// 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.