FileNameSanitizer: hostile-name edge cases survive mutation (73% score)
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 25/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- C#
- Stars
- 1
- Forks
- 3
- Avg merge
- 4h 34m
- Merged PRs (30d)
- 182
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from CodeForFire/lagebuch
-
bug ux
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
CodeForFire/lagebuch#714 ·
Maintainers usually reply within 1 day
-
bug ux
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
CodeForFire/lagebuch#713 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
CodeForFire/lagebuch#405 ·
Maintainers usually reply within 1 day
-
documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
CodeForFire/lagebuch#349 ·
Maintainers usually reply within 1 day
-
documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
CodeForFire/lagebuch#348 ·
Maintainers usually reply within 1 day
All issues in CodeForFire/lagebuch
Similar issues
-
/api/oauth/introspect emits clientId and tokenType instead of RFC 7662's client_id and token_typeOpenbug P2
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nightscout/nocturne#2317 ·
Maintainers usually reply within 1 day
-
[BUG]: Position intent set on a simple order is dropped when it becomes a bracket, OCO or OTO orderPossibly taken @RaphaelFakhri claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
alpacahq/alpaca-trade-api-csharp#903 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
joinrpg/joinrpg-net#5752 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
dimitar-radenkov/Pointframe#294 ·
Maintainers usually reply within 1 day
-
kind/feature-request
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Altinn/altinn-correspondence#2154 ·
Maintainers usually reply within 1 day