d3d12 lua: a link to nothing is not written through (D3D12-LUA-WRITE-FILE-DANGLING-LINK) #3189

Merged
RussianSanta12 merged 2 commits from upstream-pr/3189 into main 2026-12-02 21:29:55 +00:00
RussianSanta12 commented 2026-12-02 17:44:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by RussianSanta12 on 2026-12-02T17:44:14Z.


Claimed in the coordination issue as: D3D12-LUA-WRITE-FILE-DANGLING-LINK (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7353400606), from @imShangLi's finding.

What and why

manifest::inside() (d3d12/crates/leonida-lua/src/manifest.rs) found the deepest part of a mod's path that is there with Path::exists, which follows links. A link inside the mod's folder whose target is missing therefore counted as absent: the walk went on to the folder holding it (inside, so allowed), and leonida.write_file then ended in std::fs::write, which created the link's target, possibly outside the mod's folder.

The walk now uses symlink_metadata, so a link is found as itself whether or not its target exists; canonicalising a link to nothing fails, and that failure is a refusal naming the path (`name` cannot be resolved inside the mod's folder (...)). This covers a dangling link as the last part of the path and as a folder part (lib/x.txt with lib dangling). Lua has no way to make a link today, so this is hardening, not a hole a mod can reach.

Behaviour notes:

  • A link to a missing target is refused even if that target would have been inside the folder (the simplest correct rule); docs/lua-modding.md now says a link that leads "out of it, or to nothing" is refused.
  • require through such a link reports the refusal instead of "module not found" (init.lua is still tried next).
  • Writing a new file in a not-yet-existing subfolder, and reading a missing file, behave as before.
  • A link swapped in between the check and the write is still possible, as before; out of scope (no Lua API makes links).

Tested

  • New test a_link_to_nothing_is_not_written_through (src/tests.rs): a file link out.txt -> missing outside.txt, and a junction/symlink folder lib -> missing gone; both writes must be refused and neither target created. The file link is the case that escaped; it needs symlink rights on Windows (it ran here). The junction case runs without rights and pins that inside() itself refuses it (before the fix it failed later, in create_dir_all).
  • Red (only manifest.rs reverted to main, new test kept): cargo test -p leonida-lua --locked a_link_to_nothing fails with ["file true", ...] - the write went through the dangling link and created outside.txt outside the mod's folder. Reproduced independently by the reviewer agent in a throwaway worktree.
  • Green: cargo test -p leonida-lua --locked - 45 passed.
  • cargo build --workspace --all-targets --locked; cargo clippy -p leonida-lua --all-targets --locked -- -D warnings clean; rustfmt --check clean on the added lines.
  • python -I scripts/check_no_game_data.py passes; python -m unittest discover -s tests -p "test_docs_*.py" 57 OK.
  • Merges cleanly with main and with the other open leonida-lua pull requests (#3179, #3125), which touch the same test file and doc.
  • Windows 11, Rust toolchain pinned by d3d12/rust-toolchain.toml. No game files used.

GPUs tested: n/a (no GPU code; CPU-only crate tests)

AI-assisted: yes. Implementation: Claude Opus 5.5 (Claude Code). Independent read-only reviewer agent: Claude Opus 5.5 - verdict approve, no blockers; its two comment nits are applied in the second commit.

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5611801304 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3189). Originally posted by [RussianSanta12](https://github.com/RussianSanta12) on 2026-12-02T17:44:14Z. --- Claimed in the coordination issue as: D3D12-LUA-WRITE-FILE-DANGLING-LINK (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7353400606), from @imShangLi's finding. ### What and why `manifest::inside()` (`d3d12/crates/leonida-lua/src/manifest.rs`) found the deepest part of a mod's path that is there with `Path::exists`, which follows links. A link inside the mod's folder whose target is missing therefore counted as absent: the walk went on to the folder holding it (inside, so allowed), and `leonida.write_file` then ended in `std::fs::write`, which created the link's **target**, possibly outside the mod's folder. The walk now uses `symlink_metadata`, so a link is found as itself whether or not its target exists; canonicalising a link to nothing fails, and that failure is a refusal naming the path (`` `name` cannot be resolved inside the mod's folder (...) ``). This covers a dangling link as the last part of the path and as a folder part (`lib/x.txt` with `lib` dangling). Lua has no way to make a link today, so this is hardening, not a hole a mod can reach. Behaviour notes: - A link to a missing target is refused even if that target would have been inside the folder (the simplest correct rule); `docs/lua-modding.md` now says a link that leads "out of it, or to nothing" is refused. - `require` through such a link reports the refusal instead of "module not found" (`init.lua` is still tried next). - Writing a new file in a not-yet-existing subfolder, and reading a missing file, behave as before. - A link swapped in between the check and the write is still possible, as before; out of scope (no Lua API makes links). ### Tested - New test `a_link_to_nothing_is_not_written_through` (`src/tests.rs`): a file link `out.txt` -> missing `outside.txt`, and a junction/symlink folder `lib` -> missing `gone`; both writes must be refused and neither target created. The file link is the case that escaped; it needs symlink rights on Windows (it ran here). The junction case runs without rights and pins that `inside()` itself refuses it (before the fix it failed later, in `create_dir_all`). - **Red** (only `manifest.rs` reverted to `main`, new test kept): `cargo test -p leonida-lua --locked a_link_to_nothing` fails with `["file true", ...]` - the write went through the dangling link and created `outside.txt` outside the mod's folder. Reproduced independently by the reviewer agent in a throwaway worktree. - **Green**: `cargo test -p leonida-lua --locked` - 45 passed. - `cargo build --workspace --all-targets --locked`; `cargo clippy -p leonida-lua --all-targets --locked -- -D warnings` clean; `rustfmt --check` clean on the added lines. - `python -I scripts/check_no_game_data.py` passes; `python -m unittest discover -s tests -p "test_docs_*.py"` 57 OK. - Merges cleanly with `main` and with the other open `leonida-lua` pull requests (#3179, #3125), which touch the same test file and doc. - Windows 11, Rust toolchain pinned by `d3d12/rust-toolchain.toml`. No game files used. GPUs tested: n/a (no GPU code; CPU-only crate tests) AI-assisted: yes. Implementation: Claude Opus 5.5 (Claude Code). Independent read-only reviewer agent: Claude Opus 5.5 - verdict approve, no blockers; its two comment nits are applied in the second commit. ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fiestorra commented 2026-12-02 17:54:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T17:54:05Z.


Verified here: it applies on the current main and its own test passes - and one flake in the crate, which is not this pull request.

merge base 5b1fff821 (= current origin/main), head c182fc392
git apply on main

cargo test -p leonida-lua --lib      45 passed, 0 failed    (20 runs, 0 failures)

The change is the security-relevant kind: a mod path that ends in a symlink to nothing could be written through it - manifest::inside() resolved the deepest existing part and stopped there, so a dangling link looked like a valid place to put a file. The new test is in manifest, and it passes.

And the flake, which I chased first and should not be blamed on this: tests::a_scan_without_a_size_reaches_the_end_of_the_image failed once in 7 runs with the pull request, which looked like a regression - then 0 in 20 with it and 1 in 20 on main alone, so it is pre-existing and roughly one run in twenty. I am reporting it separately rather than on this pull request.

One disclosure about my own numbers: my first attempt at that A/B counted 20 failures in 20 runs on both sides, because -match 'FAILED' also matches "0 failed" in the success line. The corrected counts are the ones above - I would rather say that than have someone repeat the broken measurement.

What it does not cover: a real mod with a real dangling link. The test builds the manifest and path by hand; whether Windows and Linux resolve a dangling link the same way is the part a test cannot settle, and this is one OS.

AI-assisted: yes - DeepSeek v4.1 (flash).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353754459 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3189#issuecomment-7353754459). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T17:54:05Z. --- **Verified here: it applies on the current `main` and its own test passes - and one flake in the crate, which is not this pull request.** ``` merge base 5b1fff821 (= current origin/main), head c182fc392 git apply on main cargo test -p leonida-lua --lib 45 passed, 0 failed (20 runs, 0 failures) ``` **The change is the security-relevant kind**: a mod path that ends in a symlink to nothing could be written **through** it - **`manifest::inside()` resolved the deepest existing part and stopped there**, so a dangling link looked like a valid place to put a file. **The new test is in `manifest`, and it passes.** **And the flake, which I chased first and should not be blamed on this**: **`tests::a_scan_without_a_size_reaches_the_end_of_the_image` failed once in 7 runs with the pull request**, which looked like a regression - **then 0 in 20 with it and 1 in 20 on `main` alone**, so **it is pre-existing and roughly one run in twenty.** **I am reporting it separately rather than on this pull request.** **One disclosure about my own numbers**: **my first attempt at that A/B counted 20 failures in 20 runs on both sides**, because `-match 'FAILED'` also matches **"0 failed"** in the success line. **The corrected counts are the ones above** - **I would rather say that than have someone repeat the broken measurement.** **What it does not cover**: **a real mod with a real dangling link.** The test builds the manifest and path by hand; **whether Windows and Linux resolve a dangling link the same way is the part a test cannot settle**, and **this is one OS.** **AI-assisted:** yes - DeepSeek v4.1 (flash).
MoonEyes commented 2026-12-02 18:04:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:04:34Z.


Third-party verification of #3189 (D3D12-LUA-WRITE-FILE-DANGLING-LINK)

  • Head: c182fc3929367ff67df91930517d961adb8b5d56, merge base 45dc41f95 (= current origin/main). Merges cleanly (git merge-tree --write-tree origin/main pr/3189). GitHub mergeable_state: blocked (review required); no check runs or statuses reported on the head sha yet.
  • Claim: claiming: D3D12-LUA-WRITE-FILE-DANGLING-LINK by the author in #2570 (comment 7353400606), from imShangLi's finding (7336235812); done: ... -> #3189 (7353600281). Claimed: yes.
  • One earlier verification comment (fiestorra, 45 passed on Windows). No reviews.

Tested here: Linux, Rust 1.98.1 (the pinned toolchain). leonida-lua builds on Linux, and the test makes real unix symlinks there (#[cfg(unix)] in link/dir_link), so both cases ran.

python3 -I scripts/red_green.py pr/3189 --base origin/main --no-fetch --no-python --crate leonida-lua
  ran: cargo -p leonida-lua
  red then green (1): leonida_lua::tests::a_link_to_nothing_is_not_written_through
  pass on both: 44
  verdict: red then green
python3 -I scripts/check_no_game_data.py d3d12/crates/leonida-lua/src/manifest.rs d3d12/crates/leonida-lua/src/tests.rs docs/lua-modding.md   rc=0

So the dangling-link escape (a write through out.txt -> ../outside.txt creating the file outside the mod's folder) reproduces on main on Linux too. The pull request closes it, and the other 44 crate tests are unchanged.

Review of d3d12/crates/leonida-lua/src/manifest.rs:83-89

  • symlink_metadata stops the walk at the link itself. canonicalize of a dangling link then fails and becomes a refusal naming the path. Missing plain files and folders still walk up to an existing parent, so write_file into a new subfolder and read_file of a missing file behave as before.
  • Callers: read_file/write_file (api.rs:492, 515, 520) and the manifest script (runtime.rs:255) just propagate the error. require (api.rs:88) records the first refusal and still tries init.lua, as the body says.
  • The doc change (docs/lua-modding.md:166-169) matches the behaviour.
  • The check-then-write race is unchanged and documented as out of scope; Lua cannot create links.

Defects: none found.

Verdict: ready. Claimed, one topic, red then green reproduced here on Linux, clean-room check passes. Windows was not run here; the author and fiestorra report 45 passed there.

AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353916903 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3189#issuecomment-7353916903). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:04:34Z. --- **Third-party verification of #3189 (D3D12-LUA-WRITE-FILE-DANGLING-LINK)** - Head: `c182fc3929367ff67df91930517d961adb8b5d56`, merge base `45dc41f95` (= current `origin/main`). Merges cleanly (`git merge-tree --write-tree origin/main pr/3189`). GitHub `mergeable_state: blocked` (review required); no check runs or statuses reported on the head sha yet. - Claim: `claiming: D3D12-LUA-WRITE-FILE-DANGLING-LINK` by the author in #2570 (comment 7353400606), from imShangLi's finding (7336235812); `done: ... -> #3189` (7353600281). Claimed: yes. - One earlier verification comment (fiestorra, 45 passed on Windows). No reviews. **Tested here: Linux, Rust 1.98.1 (the pinned toolchain).** `leonida-lua` builds on Linux, and the test makes real unix symlinks there (`#[cfg(unix)]` in `link`/`dir_link`), so both cases ran. ``` python3 -I scripts/red_green.py pr/3189 --base origin/main --no-fetch --no-python --crate leonida-lua ran: cargo -p leonida-lua red then green (1): leonida_lua::tests::a_link_to_nothing_is_not_written_through pass on both: 44 verdict: red then green python3 -I scripts/check_no_game_data.py d3d12/crates/leonida-lua/src/manifest.rs d3d12/crates/leonida-lua/src/tests.rs docs/lua-modding.md rc=0 ``` So the dangling-link escape (a write through `out.txt -> ../outside.txt` creating the file outside the mod's folder) reproduces on `main` on Linux too. The pull request closes it, and the other 44 crate tests are unchanged. **Review of `d3d12/crates/leonida-lua/src/manifest.rs:83-89`** - `symlink_metadata` stops the walk at the link itself. `canonicalize` of a dangling link then fails and becomes a refusal naming the path. Missing plain files and folders still walk up to an existing parent, so `write_file` into a new subfolder and `read_file` of a missing file behave as before. - Callers: `read_file`/`write_file` (api.rs:492, 515, 520) and the manifest script (runtime.rs:255) just propagate the error. `require` (api.rs:88) records the first refusal and still tries `init.lua`, as the body says. - The doc change (docs/lua-modding.md:166-169) matches the behaviour. - The check-then-write race is unchanged and documented as out of scope; Lua cannot create links. **Defects:** none found. **Verdict: ready.** Claimed, one topic, red then green reproduced here on Linux, clean-room check passes. Windows was not run here; the author and fiestorra report 45 passed there. AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
Kal0s-design commented 2026-12-02 18:53:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T18:53:01Z.


Ran natively on Windows 11, head c182fc392 merged into current main (f1a559851, clean merge).

The thread has Linux red/green and a Windows pass. This adds what Windows actually exercises, because that turned out to be less than the test suggests.

Results (measured)

Check Result
cargo test -p leonida-lua --lib --locked on the merge 45 passed, 0 failed
Red: manifest.rs back to main, new test kept 44 passed, 1 failed (a_link_to_nothing_is_not_written_through)
cargo clippy -p leonida-lua --all-targets no warnings
cargo fmt --check only the two api.rs diffs that are already on main, nothing from this PR

On Windows the escape itself is not what the test checks here. Without Developer Mode or admin, symlink_file and symlink_dir both fail with os error 1314 (privilege not held), so link() returns false and only the junction half runs. The red above comes from the junction case, and on main it reads dir false lib/x.txt: Cannot create a file when that file already exists. (os error 183). That's a different error message, not a write outside the folder. The file-symlink case, which is the one that escapes, only runs on Linux in this thread (MoonEyes) or on a Windows box that has the symlink right. Unless the earlier Windows run had that right, it only ran the junction half too, so "passes on Windows" doesn't cover the escape by itself.

Junction cases (measured, throwaway tests, same on PR and main except for the message)

Case main PR
write_file("lib/sub/x.txt"), lib a junction to a missing folder refused, os error 183 refused, "cannot be resolved inside the mod's folder"
write_file("lib"), the dangling junction itself refused, os error 5 refused, new message
read_file("lib/x.txt") through it nil, os error 3 nil, new message
require("lib.x") through it "module not found" error names the refusal
"script": "lib/main.lua" through it Failed, "cannot read" Failed, new message
junction to a junction to nothing refused, os error 183 refused, new message
dangling junction whose target would be inside the mod refused, os error 183 refused, new message
live junction to a folder inside the mod written written
new plain subfolders new/deeper/x.txt written written

In none of these did anything get created outside the mod's folder, on either side. So on Windows without the symlink right, the PR only changes the message. What it actually protects against is a dangling file symlink, and that was shown on Linux in this thread. A dangling directory symlink on Windows should take the same path through symlink_metadata, but I couldn't make one here, so that's not run.

Checked by grep, not by running: the only filesystem calls in api.rs are metadata, read, create_dir_all and write. So a mod can't make a link at runtime, and only a link that was already in the folder matters.

Merge

Against Result
main clean
#3179 textually clean, but it does not compile. #3179 changes Runtime::new to return Runtime, and the new test here calls .unwrap() on it (E0599). Dropping that .unwrap() gives 46 passed. Whichever lands second needs the one-word fix
#3125, #3115 textually clean (git merge-tree), not built

Flake. a_scan_without_a_size_reaches_the_end_of_the_image failed 4 times in 40 named runs on the merge (--test-threads=4) and 1 in 20 on main alone. Every failure was left: ["tail 1 0"]. That's the same pre-existing flake fiestorra reported, and it doesn't go through manifest.rs. An earlier unnamed loop of 20 had 5 failures, and I didn't record which test those were.

Not checked: file or directory symlinks on Windows (no symlink right here), relative symlinks, Linux or Wine, a real mod in the game.

GPUs tested: n/a (CPU-only tests).
AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7355296579 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3189#issuecomment-7355296579). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-02T18:53:01Z. --- Ran natively on Windows 11, head `c182fc392` merged into current `main` (`f1a559851`, clean merge). The thread has Linux red/green and a Windows pass. This adds what Windows actually exercises, because that turned out to be less than the test suggests. **Results (measured)** | Check | Result | |---|---| | `cargo test -p leonida-lua --lib --locked` on the merge | 45 passed, 0 failed | | Red: `manifest.rs` back to `main`, new test kept | 44 passed, 1 failed (`a_link_to_nothing_is_not_written_through`) | | `cargo clippy -p leonida-lua --all-targets` | no warnings | | `cargo fmt --check` | only the two `api.rs` diffs that are already on `main`, nothing from this PR | **On Windows the escape itself is not what the test checks here.** Without Developer Mode or admin, `symlink_file` and `symlink_dir` both fail with os error 1314 (privilege not held), so `link()` returns false and only the junction half runs. The red above comes from the junction case, and on `main` it reads `dir false lib/x.txt: Cannot create a file when that file already exists. (os error 183)`. That's a different error message, not a write outside the folder. The file-symlink case, which is the one that escapes, only runs on Linux in this thread (MoonEyes) or on a Windows box that has the symlink right. Unless the earlier Windows run had that right, it only ran the junction half too, so "passes on Windows" doesn't cover the escape by itself. **Junction cases (measured, throwaway tests, same on PR and `main` except for the message)** | Case | `main` | PR | |---|---|---| | `write_file("lib/sub/x.txt")`, `lib` a junction to a missing folder | refused, os error 183 | refused, "cannot be resolved inside the mod's folder" | | `write_file("lib")`, the dangling junction itself | refused, os error 5 | refused, new message | | `read_file("lib/x.txt")` through it | nil, os error 3 | nil, new message | | `require("lib.x")` through it | "module not found" | error names the refusal | | `"script": "lib/main.lua"` through it | Failed, "cannot read" | Failed, new message | | junction to a junction to nothing | refused, os error 183 | refused, new message | | dangling junction whose target would be inside the mod | refused, os error 183 | refused, new message | | live junction to a folder inside the mod | written | written | | new plain subfolders `new/deeper/x.txt` | written | written | In none of these did anything get created outside the mod's folder, on either side. So on Windows without the symlink right, the PR only changes the message. What it actually protects against is a dangling file symlink, and that was shown on Linux in this thread. A dangling directory symlink on Windows should take the same path through `symlink_metadata`, but I couldn't make one here, so that's not run. Checked by grep, not by running: the only filesystem calls in `api.rs` are `metadata`, `read`, `create_dir_all` and `write`. So a mod can't make a link at runtime, and only a link that was already in the folder matters. **Merge** | Against | Result | |---|---| | `main` | clean | | #3179 | textually clean, but it does not compile. #3179 changes `Runtime::new` to return `Runtime`, and the new test here calls `.unwrap()` on it (E0599). Dropping that `.unwrap()` gives 46 passed. Whichever lands second needs the one-word fix | | #3125, #3115 | textually clean (`git merge-tree`), not built | **Flake.** `a_scan_without_a_size_reaches_the_end_of_the_image` failed 4 times in 40 named runs on the merge (`--test-threads=4`) and 1 in 20 on `main` alone. Every failure was `left: ["tail 1 0"]`. That's the same pre-existing flake fiestorra reported, and it doesn't go through `manifest.rs`. An earlier unnamed loop of 20 had 5 failures, and I didn't record which test those were. Not checked: file or directory symlinks on Windows (no symlink right here), relative symlinks, Linux or Wine, a real mod in the game. GPUs tested: n/a (CPU-only tests). AI-assisted: yes (Claude Code).
fiestorra commented 2026-12-02 20:26:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T20:26:38Z.


VERIFY-3189 — Windows nativo, con enlaces de fichero permitidos (Developer Mode), y la escapada reproducida

Head c182fc392
Merge base 45dc41f95
Merged onto main b41763227 — git merge-tree --write-tree clean, git merge --no-ff clean

Ran

cargo test -p leonida-lua     45 passed; 0 failed; 0 ignored   (0.67s)
  tests::a_link_to_nothing_is_not_written_through ... ok

Negative control (manifest.rs reverted to main, the PR's test kept), with --nocapture:

thread 'tests::a_link_to_nothing_is_not_written_through' panicked at crates\leonida-lua\src\tests.rs:1086
  ["file true", "dir false lib/x.txt: Cannot create a file when that file already exists. (os error 183)"]

That is the escape, named: "file true" means the old inside() walked past the dangling file link to the folder that holds it, write_file then wrote through the link and returned success — the file landed outside the mod's folder. The junction was refused, but only later, with the raw OS error (os error 183) rather than a reason. With this PR both read `out.txt` cannot be resolved inside the mod's folder, and the test's final !outside.exists() && !gone.exists() holds.

Both link kinds were really exercised here, not skipped: this machine has Developer Mode on (AllowDevelopmentWithoutDevLicense = 1), and a probe created a file symlink and a junction without elevation.

The valid-link cases still hold — inside() keeps the canonicalize(probe).starts_with(canon_root) check after the walk, so a link that resolves outside is still refused with `{name}` leads out of the mod's folder, and one that resolves inside is still allowed; the 45 tests include those.

What I could not test

  • A machine without link rights (the if !made_file && !made_dir { return; } branch): not exercised here, since both links could be created.
  • The rest of the Lua runtime against a real mod: only the crate's own tests; no game run.

Verdict: red then green, with the escape itself reproduced on the old code.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7357745005 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3189#issuecomment-7357745005). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T20:26:38Z. --- ## VERIFY-3189 — Windows nativo, con enlaces de fichero permitidos (Developer Mode), y la escapada reproducida | | | |---|---| | Head | `c182fc392` | | Merge base | `45dc41f95` | | Merged onto | `main` `b41763227` — `git merge-tree --write-tree` clean, `git merge --no-ff` clean | **Ran** ``` cargo test -p leonida-lua 45 passed; 0 failed; 0 ignored (0.67s) tests::a_link_to_nothing_is_not_written_through ... ok ``` **Negative control** (`manifest.rs` reverted to `main`, the PR's test kept), with `--nocapture`: ``` thread 'tests::a_link_to_nothing_is_not_written_through' panicked at crates\leonida-lua\src\tests.rs:1086 ["file true", "dir false lib/x.txt: Cannot create a file when that file already exists. (os error 183)"] ``` **That is the escape, named**: `"file true"` means the old `inside()` walked past the dangling file link to the folder that holds it, `write_file` then wrote **through** the link and returned success — the file landed outside the mod's folder. The junction was refused, but only later, with the raw OS error (`os error 183`) rather than a reason. With this PR both read `` `out.txt` cannot be resolved inside the mod's folder ``, and the test's final `!outside.exists() && !gone.exists()` holds. **Both link kinds were really exercised here**, not skipped: this machine has Developer Mode on (`AllowDevelopmentWithoutDevLicense = 1`), and a probe created a file symlink *and* a junction without elevation. **The valid-link cases still hold** — `inside()` keeps the `canonicalize(probe).starts_with(canon_root)` check after the walk, so a link that resolves outside is still refused with `` `{name}` leads out of the mod's folder ``, and one that resolves inside is still allowed; the 45 tests include those. ## What I could not test - **A machine without link rights** (the `if !made_file && !made_dir { return; }` branch): not exercised here, since both links could be created. - **The rest of the Lua runtime against a real mod**: only the crate's own tests; no game run. Verdict: **red then green**, with the escape itself reproduced on the old code. Written with an AI assistant.
EdenBendheim commented 2026-12-02 21:01:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by EdenBendheim on 2026-12-02T21:01:20Z.


RUN (in-game RTX 3090 300 s stress gate, 14-PR combined batch) — PASS covering exact head c182fc3929367ff67df91930517d961adb8b5d56.

  • Base & build: Merged cleanly via git merge --no-ff onto main b41763227 (diagnostics,dlss,mimalloc, exe_sha16 = c47eeb717f761d9d; changed-file clean-room scan exit 0; workspace test targets compiled).
  • Batch heads (14 PRs): #3200 d1a91afd1, #3198 80a627bb1, #3191 93b47ac9d, #3189 c182fc392, #3176 ae0075d9a, #3168 337388052, #3164 1065952da, #3146 ebc0253ff, #3124 64600ef0c, #3069 311d33a40, #3031 8df1bfce7, #3029 e49404808, #3054 ff53fd8b9, #3010 d645712a3.
  • Hardware & setup: Windows 11, Ryzen 9 5900X (32 GB RAM), NVIDIA GeForce RTX 3090 24 GB, driver 610.88, Series X profile, 2560x1440, -NoFrameGen, scripts/game-gate.ps1 (301.3 s in world) with downtown street-level teleport + 8-leg dynamic sprint/turn/strafe Lua mod (GATE CONTROL moved=2.51 m, max_from_ctrl=5,053.9 m).
Metric 14-PR Batch (c47eeb717f761d9d) main b41763227 baseline (cf499737bf684f6a)
Gate verdict / exit PASS (clean, 0 reasons, 0 warnings) PASS (clean, 0 reasons, 0 warnings)
World time 301.3 s (4,504 frames) 305.6 s
Device lost / crashes / missed pipeline waits 0 / 0 / 0 0 / 0 / 0
Rendered FPS (median) / p95 frame time 20.10 FPS / 69.76 ms 19.13 FPS / 74.01 ms
Median draws/frame / longest present gap 8,048 / 5.222 s 7,983 / 2.358 s

Verdict: PASS for the 300 s in-game stability gate on c182fc392 (note: this batch check confirms runtime stability with an active Lua mod, not the dangling-link unit assertion itself).

(AI-assisted verification: gemini-4-neon + gpt-6.2-astra.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7358674816 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3189#issuecomment-7358674816). Originally posted by [EdenBendheim](https://github.com/EdenBendheim) on 2026-12-02T21:01:20Z. --- **RUN (in-game RTX 3090 300 s stress gate, 14-PR combined batch)** — **PASS** covering exact head `c182fc3929367ff67df91930517d961adb8b5d56`. - **Base & build:** Merged cleanly via `git merge --no-ff` onto `main` `b41763227` (`diagnostics,dlss,mimalloc`, `exe_sha16 = c47eeb717f761d9d`; changed-file clean-room scan exit `0`; workspace test targets compiled). - **Batch heads (`14` PRs):** `#3200` `d1a91afd1`, `#3198` `80a627bb1`, `#3191` `93b47ac9d`, `#3189` `c182fc392`, `#3176` `ae0075d9a`, `#3168` `337388052`, `#3164` `1065952da`, `#3146` `ebc0253ff`, `#3124` `64600ef0c`, `#3069` `311d33a40`, `#3031` `8df1bfce7`, `#3029` `e49404808`, `#3054` `ff53fd8b9`, `#3010` `d645712a3`. - **Hardware & setup:** Windows 11, Ryzen 9 5900X (32 GB RAM), NVIDIA GeForce RTX 3090 24 GB, driver `610.88`, Series X profile, `2560x1440`, `-NoFrameGen`, `scripts/game-gate.ps1` (`301.3 s` in world) with downtown street-level teleport + 8-leg dynamic sprint/turn/strafe Lua mod (`GATE CONTROL moved=2.51 m`, `max_from_ctrl=5,053.9 m`). | Metric | 14-PR Batch (`c47eeb717f761d9d`) | `main` `b41763227` baseline (`cf499737bf684f6a`) | |---|---:|---:| | Gate verdict / exit | **PASS** (`clean`, `0` reasons, `0` warnings) | **PASS** (`clean`, `0` reasons, `0` warnings) | | World time | `301.3 s` (`4,504` frames) | `305.6 s` | | Device lost / crashes / missed pipeline waits | `0` / `0` / `0` | `0` / `0` / `0` | | Rendered FPS (median) / p95 frame time | `20.10 FPS` / `69.76 ms` | `19.13 FPS` / `74.01 ms` | | Median draws/frame / longest present gap | `8,048` / `5.222 s` | `7,983` / `2.358 s` | **Verdict:** **PASS** for the 300 s in-game stability gate on `c182fc392` (note: this batch check confirms runtime stability with an active Lua mod, not the dangling-link unit assertion itself). *(AI-assisted verification: `gemini-4-neon` + `gpt-6.2-astra`.)*
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
ProjectLeonida/mandy!3189
No description provided.