Skip to content

Commit 9362a78

Browse files
committed
use random heredoc delimiter for rejections
1 parent 18f552f commit 9362a78

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

.github/workflows/agent-release.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,12 +444,15 @@ jobs:
444444
REJECTED=$(echo "$RESPONSE" | jq '[.[] | select(.state == "rejected")] | length')
445445
if [ "$REJECTED" -gt 0 ]; then
446446
echo "was_rejected=true" >> "$GITHUB_OUTPUT"
447-
COMMENT=$(echo "$RESPONSE" | jq -r '.[] | select(.state == "rejected") | .comment // empty' | head -1)
447+
COMMENT=$(echo "$RESPONSE" | jq -r '[.[] | select(.state == "rejected") | .comment // empty] | first // empty')
448448
if [ -n "$COMMENT" ]; then
449+
# Random delimiter so reviewer-controlled comment text can never
450+
# terminate the heredoc early and truncate the output.
451+
delimiter="msg_$(openssl rand -hex 16)"
449452
{
450-
echo 'message<<EOF'
453+
echo "message<<$delimiter"
451454
echo "🚫 Release was rejected: $COMMENT"
452-
echo 'EOF'
455+
echo "$delimiter"
453456
} >> "$GITHUB_OUTPUT"
454457
else
455458
echo "message=🚫 Release was rejected." >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)