Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

fix(guardrails): block-root-delete-target judges backticks inside a quoted heredoc body

Đã đóng
#6,625 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Một pull request liên quan đã được merge.

  • #7186 của @kyle-sexton — đã merge

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
shell
Lĩnh vực
security

Hướng nghiên cứu

Start with plugins/guardrails/hooks/block-root-delete-target.sh and the hook-precision conventions in docs/conventions/hook-precision. Add a stay-quiet regression case for the quoted-heredoc payload, and verify that the unquoted-heredoc case remains refused. Done when both acceptance cases pass.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

needs-triage priority: medium

Problem

block-root-delete-target refuses a command whose quoted heredoc body (<<'EOF') contains a backticked rm -rf span. The quoted delimiter makes the body inert text: bash runs no command substitution in it. The guard still lifts the backtick span out as a substitution and judges it.

Seen in practice: gh pr create --body-file - <<'EOF' with a PR body that quoted an example command in Markdown backticks was refused. The workaround was to write the body to a file.

Repro

Payload (stdin to plugins/guardrails/hooks/block-root-delete-target.sh):

{"tool_name":"Bash","tool_input":{"command":"cat <<'EOF'\nnote: `rm -rf /`\nEOF"},"cwd":"/"}

Actual: exit 2, "recursive delete of a filesystem root". Expected: exit 0, because the heredoc delimiter is quoted.

Acceptance

  • A stay-quiet case for the payload above fails before the fix (docs/conventions/hook-precision).
  • An unquoted heredoc (<<EOF) whose body holds `rm -rf /` stays refused, because bash does run that substitution.

Related: #6020, found while working #6542.

Ngôn ngữ chính
Shell
Star
22
Fork
2
Merge trung bình
2 giờ 48 phút
Pull request đã merge (30 ngày)
939

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của melodic-software/claude-code-plugins

Tất cả issue của melodic-software/claude-code-plugins

Issue tương tự

Thêm issue về Shell/Bash

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.