Skip to content

fix(cli): reject empty or whitespace-only message content before sign… - #7027

Open
Adilmohd04 wants to merge 2 commits into
block:mainfrom
Adilmohd04:fix/empty-content-send-rejection
Open

fix(cli): reject empty or whitespace-only message content before sign…#7027
Adilmohd04 wants to merge 2 commits into
block:mainfrom
Adilmohd04:fix/empty-content-send-rejection

Conversation

@Adilmohd04

Copy link
Copy Markdown

…ing (#5744)

buzz messages send --content - accepted empty stdin, signed the event, and published a blank message to the relay. Add a
validate_content_not_empty gate that checks content.trim().is_empty() after read_or_stdin and before mention resolution, signing, or relay submission.

Summary

Related issue

Testing

…ing (block#5744)

`buzz messages send --content -` accepted empty stdin, signed the event,
and published a blank message to the relay. Add a
`validate_content_not_empty` gate that checks `content.trim().is_empty()`
after `read_or_stdin` and before mention resolution, signing, or relay
submission.


Signed-off-by: Adilmod04 <sadilmohammed0004@gmail.com>
Copilot AI lite review requested due to automatic review settings August 29, 2026 08:23
@Adilmohd04
Adilmohd04 requested a review from a team as a code owner August 29, 2026 08:23
@github-actions

github-actions Bot commented Aug 29, 2026

Copy link
Copy Markdown

🔐 Codex Security Review

Status: review required for the current range.

The current range is 00e61eafa917d296104006576b7a2ddbfd58bb5a...e51416d6252d9e02fcd07aea4dcd2d4293748ffc.
A new review must complete for this exact range. When manual authorization
is required, a Block organization member must comment exactly
@buzz-security-review e51416d6252d9e02fcd07aea4dcd2d4293748ffc to authorize a new review.
Any previous review applies only to its recorded range.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens Buzz CLI input validation to prevent buzz messages send --content - from signing and publishing empty/whitespace-only messages, aligning CLI behavior with the expected “fail fast before signing/sending” contract described in issue #5744.

Changes:

  • Add validate_content_not_empty() to reject empty or whitespace-only message content (with unit tests).
  • Call the new validation in cmd_send_message after read_or_stdin and before mention resolution/signing/submission.
  • Additionally, change cmd_get_messages --kinds parsing to error on invalid values instead of silently dropping them (references #6945).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
crates/buzz-cli/src/validate.rs Adds the new non-empty content validator and tests (also includes a formatting regression around a doc comment).
crates/buzz-cli/src/commands/messages.rs Wires the new validator into messages send; also changes --kinds parsing behavior for messages get.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/buzz-cli/src/validate.rs Outdated
Comment on lines 61 to 62
}/// Validate content does not exceed MAX_CONTENT_BYTES (65,536).
pub fn validate_content_size(content: &str) -> Result<(), CliError> {
Comment on lines +375 to +386
// If specific kinds requested, override — reject invalid values rather than
// silently dropping them (fixes #6945).
if let Some(k) = kinds {
let kind_list: Vec<u64> = k.split(',').filter_map(|s| s.trim().parse().ok()).collect();
if !kind_list.is_empty() {
filter["kinds"] = serde_json::json!(kind_list);
let kind_list: Vec<u64> = k
.split(',')
.map(|s| {
let trimmed = s.trim();
trimmed.parse::<u64>().map_err(|_| {
CliError::Usage(format!("invalid kind value in --kinds: {:?}", trimmed))
})
})
.collect::<Result<Vec<_>, _>>()?;
…lock#3357)

Mobile users opening /invite/<code> were shown "Download it now" linking to
GitHub releases (desktop binaries). This adds ios/android detection to
buzz-download.ts so iOS users land on the App Store and Android users on
Google Play, skipping the GitHub API call entirely.

Also fixes the Accept invite button being permanently disabled when the
/api/join-policy endpoint is unreachable — the catch handler now sets
policy to null instead of undefined, matching the "no policy" state.


Signed-off-by: Adilmod04 <sadilmohammed0004@gmail.com>
@Adilmohd04
Adilmohd04 force-pushed the fix/empty-content-send-rejection branch 2 times, most recently from 9ee1e8e to e51416d Compare August 29, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants