FileNameSanitizer: hostile-name edge cases survive mutation (73% score)
维护者通常 1 天内回复
已经有一个关联 PR 被合并了。
- #722 来自 @DeepDiver1975 —— 已合并
评估
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- C#
- 星标
- 1
- 派生
- 3
- 平均合并
- 4 小时 49 分钟
- 30 天内合并 PR
- 177
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
CodeForFire/lagebuch 的其他 Issue
-
Stammdaten: in the Checkliste editor the PFLICHT header is not aligned with its column可能已有人在做 @Saad-elnagar 于 1 天前认领。 未关闭bug ux
难度 2/5 1-3 小时 新手友好度 78/100
CodeForFire/lagebuch#714 · 1 条评论 ·
维护者通常 1 天内回复
-
Stammdaten: on a phone the Fahrzeuge editor squeezes Wache and Funkrufname to nothing可能已有人在做 @Saad-elnagar 于 1 天前认领。 未关闭bug ux
难度 2/5 1-3 小时 新手友好度 75/100
CodeForFire/lagebuch#713 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 62/100
CodeForFire/lagebuch#405 ·
维护者通常 1 天内回复
-
documentation good first issue
难度 2/5 1-3 小时 新手友好度 88/100
CodeForFire/lagebuch#349 ·
维护者通常 1 天内回复
-
documentation good first issue
难度 2/5 1-3 小时 新手友好度 88/100
CodeForFire/lagebuch#348 ·
维护者通常 1 天内回复
查看 CodeForFire/lagebuch 的全部 Issue
相似的 Issue
-
[Bug]: Revit selector reads process ids 2000-2099 as years (flaky AgentClientTests.AYearOrAProcessIdSelectsTheHost)可能已有人在做 @Wurschdhaud 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 83/100
pyrevitlabs/pyRevit#3817 ·
维护者通常 1 天内回复
-
bug effort:S P2
难度 2/5 1-3 小时 新手友好度 76/100
nightscout/nocturne#2449 ·
维护者通常 1 天内回复
-
audit:1 bug
难度 2/5 1-3 小时 新手友好度 76/100
NethermindEth/dotnet-libp2p#395 ·
维护者通常 1 天内回复
-
area: client bug
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
bug mcp misleading small
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复