loader(windows): reject non-simple, ADS, and NUL title DLL import names #94

Merged
Androtim merged 1 commit from upstream-pr/94 into main 2026-11-29 10:05:18 +00:00
Androtim commented 2026-11-29 09:34:15 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T09:34:15Z.


Summary

Adapted from upstream VIctory-NVIDIA (de2574d0, GPL-3.0), extracted cleanly on origin/main (5d40f8b) with zero overlap against any open PR:

  • Lexical title DLL import validation (crates/victory-loader/src/windows.rs): Adds is_simple_title_dll_name() inside map_dll() after seen/wanted checks and before dirs.0.join(&name) so non-simple module names (parent components, subdirectories, drive/UNC prefixes, NTFS : alternate streams, and embedded \0) are ignored with a warning log.

Verification

  • cargo xtask policy: asset policy: 303 files ok
  • cargo test -p victory-loader --lib --locked: 54 passed; 0 failed (including 5 new windows::tests::* cases)
  • cargo clippy --workspace --all-targets --locked -- -D warnings: 0 warnings
  • cargo clippy --workspace --all-targets --features diagnostics --locked -- -D warnings: 0 warnings
<!-- greyfinch-sync:Androtim/MiniVI:issue:5549453190 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/94). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-29T09:34:15Z. --- ## Summary Adapted from upstream `VIctory-NVIDIA` (`de2574d0`, GPL-3.0), extracted cleanly on `origin/main` (`5d40f8b`) with zero overlap against any open PR: - **Lexical title DLL import validation (`crates/victory-loader/src/windows.rs`):** Adds `is_simple_title_dll_name()` inside `map_dll()` after `seen`/`wanted` checks and before `dirs.0.join(&name)` so non-simple module names (parent components, subdirectories, drive/UNC prefixes, NTFS `:` alternate streams, and embedded `\0`) are ignored with a warning log. ## Verification - `cargo xtask policy`: `asset policy: 303 files ok` - `cargo test -p victory-loader --lib --locked`: **54 passed; 0 failed** (including 5 new `windows::tests::*` cases) - `cargo clippy --workspace --all-targets --locked -- -D warnings`: **0 warnings** - `cargo clippy --workspace --all-targets --features diagnostics --locked -- -D warnings`: **0 warnings**
Androtim commented 2026-11-29 10:02:46 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T10:02:46Z.


Automated triage for the maintainers (not an approval).

Verdict: merge-candidate · CI (check): passing

Review Summary

Clean, well-scoped security hardening in crates/victory-loader/src/windows.rs.

  • map_dll(): Reorders seen.insert / wanted(&name) checks ahead of dirs.0.join(&name) and guards path joining with is_simple_title_dll_name(&name), logging a tracing::warn! and returning Ok(()) for rejected names. This preserves host/HLE import filtering while preventing untrusted PE import/delay-import names (or load_title_dll inputs) from escaping title_dir via relative traversal, subdirectories, drive/UNC prefixes, NTFS alternate data streams (:), or embedded NUL bytes (\0).
  • is_simple_title_dll_name(): Checks name.contains([':', '\0']) and verifies Path::new(name).components() yields exactly one Component::Normal(_), with a clear doc comment noting the lexical scope (symlink/reparse-point containment left to future canonicalization).
  • Tests: Adds 5 unit tests in windows::tests covering normal DLL names, parent traversal (../, ..\), subdirectories, ADS/NUL, and rooted/drive/UNC/verbatim prefixes.
  • Scope & CI: No overlap with other open PRs, CI is passing, and no real-GPU testing is required.

Verdict: merge-candidate (automated triage review; not a formal maintainer approval).


Generated with Antigravity CLI (agy).

<!-- greyfinch-sync:Androtim/MiniVI:comment:7254169673 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/94#issuecomment-7254169673). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-29T10:02:46Z. --- <!-- minivi-triage v1 head=716185759932effdaec56b0b137c41c7792f16e5 verdict=merge-candidate ci=passing at=2026-11-29T10:03:18Z --> Automated triage for the maintainers (not an approval). **Verdict:** `merge-candidate` · **CI (`check`):** `passing` ### Review Summary Clean, well-scoped security hardening in `crates/victory-loader/src/windows.rs`. - **`map_dll()`**: Reorders `seen.insert` / `wanted(&name)` checks ahead of `dirs.0.join(&name)` and guards path joining with `is_simple_title_dll_name(&name)`, logging a `tracing::warn!` and returning `Ok(())` for rejected names. This preserves host/HLE import filtering while preventing untrusted PE import/delay-import names (or `load_title_dll` inputs) from escaping `title_dir` via relative traversal, subdirectories, drive/UNC prefixes, NTFS alternate data streams (`:`), or embedded NUL bytes (`\0`). - **`is_simple_title_dll_name()`**: Checks `name.contains([':', '\0'])` and verifies `Path::new(name).components()` yields exactly one `Component::Normal(_)`, with a clear doc comment noting the lexical scope (symlink/reparse-point containment left to future canonicalization). - **Tests**: Adds 5 unit tests in `windows::tests` covering normal DLL names, parent traversal (`../`, `..\`), subdirectories, ADS/NUL, and rooted/drive/UNC/verbatim prefixes. - **Scope & CI**: No overlap with other open PRs, CI is passing, and no real-GPU testing is required. **Verdict:** `merge-candidate` (automated triage review; not a formal maintainer approval). --- _Generated with Antigravity CLI (`agy`)._
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Androtim/MiniVI!94
No description provided.