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

FileNameSanitizer: hostile-name edge cases survive mutation (73% score)

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

@DeepDiver1975 đang làm issue này rồi.

Từ ngày 21/10/2026.

  • #722 của @DeepDiver1975 — đang mở

Đá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
25/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
csharp
Lĩnh vực
security, testing

Hướng nghiên cứu

Read Files/FileNameSanitizer.cs, the listed mutation survivors, and the relevant tests under tests/Lagebuch.Domain.Tests; first run make mutate PROJECT=Domain to inspect the report. Add a test for each listed hostile input and verify each test fails against its mutant. The issue also asks to raise the floor in tests/Lagebuch.Domain.Tests/stryker-config.json; done means the new tests cover the cases and the Domain mutation score floor is raised. An open linked pull request (#722) already covers this work.

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

Mô tả

The weekly mutation run (2026-10-21, run 39560645989) scores Files/FileNameSanitizer.cs at 73 %. That is low for code at the trust boundary: it cleans the file names a sync peer sends and the names read back from an .fwincident. Line numbers below are as of 058273e.

These survivors are hostile-input paths with no test:

Line Survivor What goes untested
61 the IsNullOrWhiteSpace early return null removed TrySanitize(null). Without the guard, fileName.Trim() throws, so no test passes null.
80 TrySanitize(...) ?? fallback (no coverage) Sanitize returning its fallback when nothing usable is left, e.g. "..." or "‮"
100 <= MaxFileNameBytes → < a name of exactly 255 UTF-8 bytes being kept as is
107, 110 >= MaxFileNameBytes → >; the pathological branch (no coverage) an "extension" of 255 bytes or more. Without that branch, new byte[MaxFileNameBytes - extensionBytes] gets a negative size and throws.
119 flush: false → true a stem cut right at a surrogate pair. With flush: true, half an emoji is encoded as a replacement character.

Line 68 (IndexOf(...) < 0 → <= 0) is equivalent on Linux, because the first invalid character there is \0, which IsHidden already drops. Leave it.

Reproduce
make mutate PROJECT=Domain
# report: StrykerOutput/Domain/reports/mutation-report.html, file Files/FileNameSanitizer.cs
Suggested approach

Follow AGENTS.md: write one test per row that replays the hostile name and fails against its mutant first:

  • null;
  • a name made only of dots or bidi overrides;
  • a 255-byte name;
  • "a." + new string('x', 300);
  • a long stem of emoji cut at the limit.

Fixing these raises Domain's score. Raise its floor in tests/LageBuch.Domain.Tests/stryker-config.json in the same pull request.

Ngôn ngữ chính
C#
Star
1
Fork
3
Merge trung bình
4 giờ 34 phút
Pull request đã merge (30 ngày)
182

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 CodeForFire/lagebuch

Tất cả issue của CodeForFire/lagebuch

Issue tương tự

Thêm issue về C#

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.