From dd3a820e5754a0f8896d3030cb9a475f6a8ce4b5 Mon Sep 17 00:00:00 2001 From: damocles Date: Fri, 22 May 2026 23:31:14 +0200 Subject: [PATCH] hive-forge: reject empty/whitespace-only comment bodies (closes #297, closes #299) --- nix/packages/hive-forge-tools.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nix/packages/hive-forge-tools.nix b/nix/packages/hive-forge-tools.nix index 2b2cbda..188b279 100644 --- a/nix/packages/hive-forge-tools.nix +++ b/nix/packages/hive-forge-tools.nix @@ -148,6 +148,9 @@ pkgs.writeShellApplication { else _body="$*" fi + if [ -z "$(printf '%s' "$_body" | tr -d '[:space:]')" ]; then + echo "hive-forge comment: refusing to post empty comment body" >&2; exit 1 + fi local _payload _payload=$(jq -n --arg body "$_body" '{body:$body}') forge_post "$FORGE_API/repos/$_repo/issues/$_n/comments" "$_payload" \ @@ -174,6 +177,9 @@ pkgs.writeShellApplication { _body="$1"; shift if [ $# -gt 0 ]; then _repo="$1"; fi fi + if [ -z "$(printf '%s' "$_body" | tr -d '[:space:]')" ]; then + echo "hive-forge comment-edit: refusing to post empty comment body" >&2; exit 1 + fi local _payload _payload=$(jq -n --arg body "$_body" '{body:$body}') forge_patch "$FORGE_API/repos/$_repo/issues/comments/$_id" "$_payload" \