Git checks: follow `cd <dir> &&` in chained commands

Đang mở
#23 0 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

Chưa có ai nhận issue này.

Đá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ệ
git, python, shell
Lĩnh vực
security, tooling

Hướng nghiên cứu

Start with the hook code that splits a command on && and ; and runs Git checks using its cwd. Trace how a plain cd part is parsed, including relative paths and ~ expansion, and how an unresolvable target should fall back to the hook directory. Add regression tests for a blocked cd dir && git add -A and an allowed equivalent using only fake paths and values.

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

Mô tả

enhancement

cd /path/proj && git add -A && git commit -m wip is probably the commonest way an agent stages files in another folder. The guard checks each && part on its own, but runs the Git checks against the hook's cwd, not the folder the cd moved to. A secrets file, or a settings file holding a secret, in /path/proj isn't caught.

Done when

  • In a chain of && / ; parts, a plain cd <dir> changes the folder used for the parts after it (relative to the current one, with ~ expanded).
  • If the folder can't be worked out (for example cd "$VAR"), the guard falls back to the hook's cwd and keeps today's behaviour.
  • Regression tests cover a blocked cd dir && git add -A and an allowed one, with fake values only.

Found while reviewing #19.


Generated by Claude Code

Ngôn ngữ chính
Python
Star
1
Fork
1
Merge trung bình
2 giờ 28 phút
Pull request đã merge (30 ngày)
6

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 JTHCode/secretguard

Tất cả issue của JTHCode/secretguard

Issue tương tự

Thêm issue về Python

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.