fix(cli): sanitizePathForDisplay keeps Unicode format characters such as bidi overrides

Đang mở Phù hợp với người mới
#173 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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/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ệ
go
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu với sanitizePathForDisplay trong internal/cli/uninit.go, hàm này loại bỏ các rune có unicode.IsControl trả về true, và với hàm sanitizeControl bị trùng lặp trong internal/cli/present/sanitize.go. Thêm kiểm tra unicode.Cf hoặc ký tự điều khiển bidi vào cả hai, sau đó thêm một trường hợp Cf vào test của từng hàm trợ giúp. Hoàn thành khi U+202E và U+200B bị loại khỏi đầu ra và các test hiện có vẫn chạy đạt.

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

Mô tả

bug priority:low

sanitizePathForDisplay (internal/cli/uninit.go) removes the runes for which unicode.IsControl is true. That is Unicode category Cc only. Category Cf runes pass through, for example U+202E RIGHT-TO-LEFT OVERRIDE and U+200B ZERO WIDTH SPACE. A path that holds them can display as a different path from the one on disk.

Every CLI path display goes through this helper, including the skipped-registry-file warning that the #155 change adds. internal/cli/present/sanitize.go keeps a duplicate, sanitizeControl, with the same rule.

Severity

Low. Display only, and the helper was written this way before #155. Someone who can name a file the CLI prints can already show the user a misleading name. The fix stops the display from hiding it.

What to do

  • Also drop unicode.Is(unicode.Cf, r) runes, or at least the bidi controls (U+202A–U+202E, U+2066–U+2069), in both helpers.
  • Add a Cf case to each helper's test.

Found by the security reviewer in the suite review of the #155 implementation branch (information level).

🤖 Generated with Claude Code

https://claude.ai/code/session_016kpFpXsCNuZSmh5X7ebdwU

Ngôn ngữ chính
Go
Star
0
Fork
0
Merge trung bình
7 giờ 42 phút
Pull request đã merge (30 ngày)
111

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 seanb4t/codegraph-go

Tất cả issue của seanb4t/codegraph-go

Issue tương tự

Thêm issue về Go

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.