WIP: fix(sandbox): Windows: a confined game writes the diagnostic folders the real environment names, as on Linux, and no wider #2847

Closed
llun wants to merge 2 commits from fix/mod-api-win-sandbox-diagnostics into mod-api
Member

Summary

For #2822 (into mod-api). On Windows a confined game cannot write the folders its diagnostic switches name: RX_VK_SHOTS (the renderer's shots, headless ones too), HOS_PROFILE_DIR, HOS_SHADER_DUMP, RX_VK_DUMP, RX_VK_HANG_DUMP. Unless such a folder is inside one the game already writes (diagnostics\logs\), the shots and dumps go nowhere: the folder is not even made. Linux's plan writes them (sandbox_linux.rs diagnostic_dirs, docs/dev/reference/sandbox.md's Linux table). env_own.rs says the Windows plan grants what such a switch names, but the Windows plan had no grant for them.

The builder's Windows plan now takes these five switches from the real environment and the command alone (Env::real in gather.rs), never from a file of switches: longshot_env.txt takes no path, and HOS_ENV_FILE's file may be one a confined run can write. Each folder is served as a written root, made first. It goes through Grants::add's checks (no drive's root, no short name, nothing at or above the player's own folders or the grants' record's folder) and two checks of its own (Grants::add_diagnostic in plan.rs):

  • nothing at or above a folder or file the plan gives: the game folder written would let the game rewrite its own exe, image or switches; the same for the user folder, the save folder, the player's .nup;
  • nothing inside one the game only reads: the game folder, its bin\, mods\ and romfs\, DLSS's runtime (DLLs the renderer loads), a file read whole.

Inside a folder the game already writes, it is that folder's: nothing new. A refused folder is said in the log (sandbox: not granted: ... (a diagnostic switch's folder at or above one of the game's or the player's)). docs/dev/reference/sandbox.md's Windows table gets the row.

Not in this PR: Linux also writes the folders of seven diagnostic files (RX_VK_FRAME_LOG, HOS_CHAIN...). On Windows those would need a folder granted for one file, a wider grant, so they are left out here.

To see it on mod-api: start the game confined (longshot-builder game) with RX_VK_SHOTS set to a folder outside the game folder's own: no shot is written.

Read first: Grants::add_diagnostic in builder/crates/build-core/src/sandbox_windows/plan.rs.

Testing

Tested: Windows 11, RTX 5080, NVIDIA 621.40, the game confined, headless, RX_VK_SHOTS set to build-windows\shots-diag-*, a folder beside the game folder (not in it, not above it), a shot every 10 frames, 20 s. The game and its runtime were the same for both runs; only the builder differs.

  • Before (the builder from mod-api): no grant for the folder, the folder not made, no shot written.
  • After (the builder with this PR): sandbox: allowed write ...\build-windows\shots-diag-after (a diagnostic switch's folder (the real environment's)), served by the builder, then 135 vk: present N written to ...\shots-diag-after\vk_...png.

Both runs are on mod-api with #2726's save-folder fix and its broker change applied locally, beneath this PR: on plain mod-api a confined Windows start with a profile stops at the save folder. The shots were deleted after.

Checks, on Windows (cargo test -p build-core --lib --target x86_64-pc-windows-gnullvm with llvm-mingw):

  • sandbox_windows::gather::tests::a_diagnostic_folder_the_environment_names_is_written_and_no_wider_one, through plan_for with a real command: each of the five set to a folder of its own is a written root; %USERPROFILE% and C:\ are neither a root nor an ACL; a folder named only by HOS_ENV_FILE's file is not granted. It fails on mod-api (no root for RX_VK_SHOTS) and passes here.
  • sandbox_windows::plan::tests::a_diagnostic_folder_is_written_alone_and_never_over_or_in_what_the_game_only_reads, on the launcher's layout the plan's tests use: C:\Dev\shots written, served, made first; the plan unchanged, and the refusal said, for the game folder, a folder above it, bin\shots, mods\shots, romfs\, the user folder, the .nup's folder, DLSS's runtime, %LOCALAPPDATA%\Longshot (the record's), %USERPROFILE% and C:\; and nothing new for logs\shots, inside a written folder.
  • Each refusal is load-bearing. Without the "at or above" check, or without the "inside one read" check, the plan test fails. With the folders taken from the file-overlaid environment instead of the real one, the gather test fails. Each change was undone after.
  • build-core's library: 98 pass here, 96 on mod-api. The two that fail here fail the same way on mod-api: driver_caches::…the_caches_are_longshots_own_unless_one_is_named (#2834 fixes it) and files_windows::…the_cache_takes_files_folders_renames_and_removes.
  • tests/test_sandbox_windows.py passes: it reads gather.rs and checks it starts nothing (no Command::new), so the gather test, which builds a command but never starts it, is in gather/tests.rs.
  • cargo fmt --check passes. cargo clippy -p build-core --all-targets --no-deps -- -D warnings (Windows target) passes with #2830 beneath (alone, mod-api's own channel.rs and control.rs lints stop it first). mise run lint passes.

Still to test:

  • Windows, with a window: RX_VK_SHOTS and F12's shots, and a HOS_PROFILE_DIR profiler run, into a folder of their own (by hand)
  • Linux: cargo test -p build-core (CI; the new tests are Windows', the Linux plan is untouched)

Measurements

Verdict: fixed. A confined game on Windows writes its diagnostic switches' folders, and none wider.

Baseline: mod-api (#2822's head), the branch this PR goes into. Nothing to time: the plan gains up to five roots.

Before: mod-api @ c5e5b676 After: this PR @ 32913bf0a
Shots written to RX_VK_SHOTS beside the game folder, 20 s, one per 10 frames 0 135
a_diagnostic_folder_the_environment_names_is_written_and_no_wider_one FAIL (no root) pass
a_diagnostic_folder_is_written_alone_and_never_over_or_in_what_the_game_only_reads (new) pass

Risks

The sandbox: this PR widens what a confined game may write on Windows, but only to the folders a developer's real environment names for these five switches. It keeps every refusal Grants::add has, and adds two: nothing at or above anything the plan gives, and nothing inside what the game only reads. A player's longshot_env.txt cannot name them (it takes no path), and neither can HOS_ENV_FILE's file. Each folder is a root of the builder's file service, opened through its no-link walk like every other root; no ACL changes. Each refusal is pinned by a test that fails without it (above).

Beside #2747, whose latest comment adds the test mode's folder (--mod-tests, HOS_MOD_TESTS) to the same Windows plan from the command and environment: the two add separate roots, and whichever lands second may need a rebase in gather.rs.

What a developer's environment points the switches at, the game can write: a folder of the developer's choosing, as on Linux. Up to five roots more. A revert is enough.

Checklist

Ready for review

  • One topic, on current mod-api (#2822's head); the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named). (The checks this change reaches pass, as above. mod-api's whole suite has failures on Windows that this PR doesn't change: #2826 fixes six of them.)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here. (It fails on mod-api, where the bug is.)
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary For [#2822](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2822) (into `mod-api`). On Windows a confined game cannot write the folders its diagnostic switches name: `RX_VK_SHOTS` (the renderer's shots, headless ones too), `HOS_PROFILE_DIR`, `HOS_SHADER_DUMP`, `RX_VK_DUMP`, `RX_VK_HANG_DUMP`. Unless such a folder is inside one the game already writes (`diagnostics\logs\`), the shots and dumps go nowhere: the folder is not even made. Linux's plan writes them (`sandbox_linux.rs` `diagnostic_dirs`, docs/dev/reference/sandbox.md's Linux table). `env_own.rs` says the Windows plan grants what such a switch names, but the Windows plan had no grant for them. The builder's Windows plan now takes these five switches **from the real environment and the command alone** (`Env::real` in `gather.rs`), never from a file of switches: `longshot_env.txt` takes no path, and `HOS_ENV_FILE`'s file may be one a confined run can write. Each folder is served as a written root, made first. It goes through `Grants::add`'s checks (no drive's root, no short name, nothing at or above the player's own folders or the grants' record's folder) and two checks of its own (`Grants::add_diagnostic` in `plan.rs`): - **nothing at or above a folder or file the plan gives**: the game folder written would let the game rewrite its own exe, image or switches; the same for the user folder, the save folder, the player's `.nup`; - **nothing inside one the game only reads**: the game folder, its `bin\`, `mods\` and `romfs\`, DLSS's runtime (DLLs the renderer loads), a file read whole. Inside a folder the game already writes, it is that folder's: nothing new. A refused folder is said in the log (`sandbox: not granted: ... (a diagnostic switch's folder at or above one of the game's or the player's)`). docs/dev/reference/sandbox.md's Windows table gets the row. Not in this PR: Linux also writes the folders of seven diagnostic *files* (`RX_VK_FRAME_LOG`, `HOS_CHAIN`...). On Windows those would need a folder granted for one file, a wider grant, so they are left out here. **To see it on `mod-api`:** start the game confined (`longshot-builder game`) with `RX_VK_SHOTS` set to a folder outside the game folder's own: no shot is written. Read first: `Grants::add_diagnostic` in `builder/crates/build-core/src/sandbox_windows/plan.rs`. ## Testing **Tested:** Windows 11, RTX 5080, NVIDIA 621.40, the game confined, headless, `RX_VK_SHOTS` set to `build-windows\shots-diag-*`, a folder beside the game folder (not in it, not above it), a shot every 10 frames, 20 s. The game and its runtime were the same for both runs; only the builder differs. - Before (the builder from `mod-api`): no grant for the folder, the folder not made, no shot written. - After (the builder with this PR): `sandbox: allowed write ...\build-windows\shots-diag-after (a diagnostic switch's folder (the real environment's)), served by the builder`, then 135 `vk: present N written to ...\shots-diag-after\vk_...png`. Both runs are on `mod-api` with [#2726](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2726)'s save-folder fix and its broker change applied locally, beneath this PR: on plain `mod-api` a confined Windows start with a profile stops at the save folder. The shots were deleted after. Checks, on Windows (`cargo test -p build-core --lib --target x86_64-pc-windows-gnullvm` with llvm-mingw): - `sandbox_windows::gather::tests::a_diagnostic_folder_the_environment_names_is_written_and_no_wider_one`, through `plan_for` with a real command: each of the five set to a folder of its own is a written root; `%USERPROFILE%` and `C:\` are neither a root nor an ACL; a folder named only by `HOS_ENV_FILE`'s file is not granted. It fails on `mod-api` (no root for `RX_VK_SHOTS`) and passes here. - `sandbox_windows::plan::tests::a_diagnostic_folder_is_written_alone_and_never_over_or_in_what_the_game_only_reads`, on the launcher's layout the plan's tests use: `C:\Dev\shots` written, served, made first; the plan unchanged, and the refusal said, for the game folder, a folder above it, `bin\shots`, `mods\shots`, `romfs\`, the user folder, the `.nup`'s folder, DLSS's runtime, `%LOCALAPPDATA%\Longshot` (the record's), `%USERPROFILE%` and `C:\`; and nothing new for `logs\shots`, inside a written folder. - Each refusal is load-bearing. Without the "at or above" check, or without the "inside one read" check, the plan test fails. With the folders taken from the file-overlaid environment instead of the real one, the gather test fails. Each change was undone after. - `build-core`'s library: 98 pass here, 96 on `mod-api`. The two that fail here fail the same way on `mod-api`: `driver_caches::…the_caches_are_longshots_own_unless_one_is_named` ([#2834](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2834) fixes it) and `files_windows::…the_cache_takes_files_folders_renames_and_removes`. - `tests/test_sandbox_windows.py` passes: it reads `gather.rs` and checks it starts nothing (no `Command::new`), so the gather test, which builds a command but never starts it, is in `gather/tests.rs`. - `cargo fmt --check` passes. `cargo clippy -p build-core --all-targets --no-deps -- -D warnings` (Windows target) passes with [#2830](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2830) beneath (alone, `mod-api`'s own `channel.rs` and `control.rs` lints stop it first). `mise run lint` passes. **Still to test:** - Windows, with a window: `RX_VK_SHOTS` and F12's shots, and a `HOS_PROFILE_DIR` profiler run, into a folder of their own (by hand) - Linux: `cargo test -p build-core` (CI; the new tests are Windows', the Linux plan is untouched) ## Measurements **Verdict:** fixed. A confined game on Windows writes its diagnostic switches' folders, and none wider. Baseline: `mod-api` (#2822's head), the branch this PR goes into. Nothing to time: the plan gains up to five roots. | | Before: mod-api @ c5e5b676 | After: this PR @ 32913bf0a | |---|---|---| | Shots written to `RX_VK_SHOTS` beside the game folder, 20 s, one per 10 frames | 0 | 135 | | `a_diagnostic_folder_the_environment_names_is_written_and_no_wider_one` | FAIL (no root) | pass | | `a_diagnostic_folder_is_written_alone_and_never_over_or_in_what_the_game_only_reads` | (new) | pass | ## Risks **The sandbox:** this PR widens what a confined game may write on Windows, but only to the folders a developer's real environment names for these five switches. It keeps every refusal `Grants::add` has, and adds two: nothing at or above anything the plan gives, and nothing inside what the game only reads. A player's `longshot_env.txt` cannot name them (it takes no path), and neither can `HOS_ENV_FILE`'s file. Each folder is a root of the builder's file service, opened through its no-link walk like every other root; no ACL changes. Each refusal is pinned by a test that fails without it (above). Beside [#2747](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2747), whose latest comment adds the test mode's folder (`--mod-tests`, `HOS_MOD_TESTS`) to the same Windows plan from the command and environment: the two add separate roots, and whichever lands second may need a rebase in `gather.rs`. What a developer's environment points the switches at, the game can write: a folder of the developer's choosing, as on Linux. Up to five roots more. A revert is enough. ## Checklist ### Ready for review - [x] One topic, on current `mod-api` (#2822's head); the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [ ] `mise run test` passes (any failure that also fails on `main` is named). (The checks this change reaches pass, as above. `mod-api`'s whole suite has failures on Windows that this PR doesn't change: [#2826](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2826) fixes six of them.) - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. (It fails on `mod-api`, where the bug is.) - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
On Linux the builder's plan writes the folders of the diagnostic switches the real environment sets (RX_VK_SHOTS,
HOS_PROFILE_DIR, HOS_SHADER_DUMP, RX_VK_DUMP, RX_VK_HANG_DUMP: sandbox_linux.rs diagnostic_dirs), never the home,
the root or a system folder. On Windows the plan gives none, so a confined game's headless shots, profiler runs and
dumps fail to open ("PNG open failed (error 13)"). Through plan_for with a real command: each of the five set to a
folder of its own is a written root; the player's own folder and a drive's root are neither a root nor an ACL; and a
file of switches (HOS_ENV_FILE's, which a confined run may be able to write) names none. The first part fails on
mod-api: no root for RX_VK_SHOTS.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(sandbox): Windows: a confined game writes the diagnostic folders the real environment names, as on Linux, and no wider
All checks were successful
PR description / Title and description (pull_request_target) Successful in 8s
1b3a92b238
A confined game's RX_VK_SHOTS, HOS_PROFILE_DIR, HOS_SHADER_DUMP, RX_VK_DUMP and RX_VK_HANG_DUMP folders had no grant on
Windows, so its headless shots, profiler runs and dumps failed to open (Linux's plan writes them: sandbox_linux.rs
diagnostic_dirs). The builder's Windows plan takes them from the real environment and the command alone, never a file
of switches (Env::real), and serves each as a written root, made first, through Grants::add's checks (no drive's root,
no short name, nothing at or above the player's own folders or the record's) and two of its own (add_diagnostic):
nothing at or above a folder or file the plan gives (the game folder written would let the game rewrite its exe, image
or switches), nothing inside one the game only reads (its bin\, mods\, romfs\, DLSS's runtime, a file read whole).
Inside a written folder it is that one's. docs/dev/reference/sandbox.md's Windows table says so.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

Tested in the game: Windows 11, RTX 5080, NVIDIA 621.40, confined through longshot-builder game, headless, RX_VK_SHOTS set to a folder beside the game folder (not in it, not above it), a shot every 10 frames, 20 s. The game and runtime were the same for both runs; only the builder differs. Both are on mod-api with #2726's save-folder fix and its broker change applied locally, beneath this PR.

  • Before, the builder from mod-api: no grant, the folder not made, no shot.
  • After, the builder with this PR: sandbox: allowed write ...\build-windows\shots-diag-after (a diagnostic switch's folder (the real environment's)), served by the builder, then 135 vk: present N written to ...\shots-diag-after\vk_...png.

The shots were deleted after.

Tested in the game: Windows 11, RTX 5080, NVIDIA 621.40, confined through `longshot-builder game`, headless, `RX_VK_SHOTS` set to a folder beside the game folder (not in it, not above it), a shot every 10 frames, 20 s. The game and runtime were the same for both runs; only the builder differs. Both are on `mod-api` with #2726's save-folder fix and its broker change applied locally, beneath this PR. - Before, the builder from `mod-api`: no grant, the folder not made, no shot. - After, the builder with this PR: `sandbox: allowed write ...\build-windows\shots-diag-after (a diagnostic switch's folder (the real environment's)), served by the builder`, then 135 `vk: present N written to ...\shots-diag-after\vk_...png`. The shots were deleted after.
Author
Member

On hold. The direction for the confined game is that it writes nothing itself and everything goes through the broker, and the game's writes are getting an audit. This PR gives the game five more written roots (served by the builder, but still the game's writes), so it waits on that audit rather than going in as it is. If the diagnostics should come out through the broker instead (the game hands the shot or dump over, the builder writes it), this PR's refusals and tests are a starting point for which folders the builder may write to.

On hold. The direction for the confined game is that it writes nothing itself and everything goes through the broker, and the game's writes are getting an audit. This PR gives the game five more written roots (served by the builder, but still the game's writes), so it waits on that audit rather than going in as it is. If the diagnostics should come out through the broker instead (the game hands the shot or dump over, the builder writes it), this PR's refusals and tests are a starting point for which folders the builder may write to.
llun force-pushed fix/mod-api-win-sandbox-diagnostics from 1b3a92b238
All checks were successful
PR description / Title and description (pull_request_target) Successful in 8s
to ce95b8dae6
All checks were successful
PR description / Title and description (pull_request_target) Successful in 12s
2026-11-30 01:33:13 +00:00
Compare
Author
Member

Rebased onto mod-api @ 537c2816 (#2848, game-free checks' fixtures only), now ce95b8da: the same diff (same git patch-id), no conflict. #2848 touches none of this PR's files, so its checks still hold.

Rebased onto `mod-api` @ 537c2816 ([#2848](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2848), game-free checks' fixtures only), now ce95b8da: the same diff (same `git patch-id`), no conflict. #2848 touches none of this PR's files, so its checks still hold.
llun force-pushed fix/mod-api-win-sandbox-diagnostics from ce95b8dae6
All checks were successful
PR description / Title and description (pull_request_target) Successful in 12s
to c86db115c7
All checks were successful
PR description / Title and description (pull_request_target) Successful in 10s
2026-11-30 02:14:39 +00:00
Compare
Author
Member

Rebased onto mod-api aea64d3a (#2745 nav.closest, one new commit): ce95b8da -> c86db115, the same diff (git patch-id unchanged), so the checks and runs above still hold; none of this PR's files changed on mod-api. The description's head hash is updated.

Rebased onto mod-api aea64d3a (#2745 nav.closest, one new commit): ce95b8da -> c86db115, the same diff (git patch-id unchanged), so the checks and runs above still hold; none of this PR's files changed on mod-api. The description's head hash is updated.
llun force-pushed fix/mod-api-win-sandbox-diagnostics from c86db115c7
All checks were successful
PR description / Title and description (pull_request_target) Successful in 10s
to 766e919838
All checks were successful
PR description / Title and description (pull_request_target) Successful in 8s
2026-11-30 03:14:36 +00:00
Compare
Author
Member

Rebased onto the new mod-api cb37f5ab (#2851 native mouse camera, #2852 modding docs), which touch none of this PR's files: the same patch (same patch-id), head 766e9198.

Rebased onto the new `mod-api` cb37f5ab (#2851 native mouse camera, #2852 modding docs), which touch none of this PR's files: the same patch (same patch-id), head 766e9198.
llun force-pushed fix/mod-api-win-sandbox-diagnostics from 766e919838
All checks were successful
PR description / Title and description (pull_request_target) Successful in 8s
to c098adff08
All checks were successful
PR description / Title and description (pull_request_target) Successful in 8s
2026-11-30 04:14:40 +00:00
Compare
Author
Member

Rebased onto mod-api @ 12f42db5 (#2855 rustfmt of nav.closest, #2861 menu rows by place): head 766e91983 -> c098adff0, the same diff (patch-id unchanged); neither commit touches this PR's files.

Rebased onto mod-api @ 12f42db5 (#2855 rustfmt of nav.closest, #2861 menu rows by place): head 766e91983 -> c098adff0, the same diff (patch-id unchanged); neither commit touches this PR's files.
llun force-pushed fix/mod-api-win-sandbox-diagnostics from c098adff08
All checks were successful
PR description / Title and description (pull_request_target) Successful in 8s
to 1075dd8f9a
All checks were successful
PR description / Title and description (pull_request_target) Successful in 5s
2026-11-30 18:14:07 +00:00
Compare
Author
Member

Rebased onto mod-api @ 75bcd270 (#2881 a mod adds a game language): head c098adff0 -> 1075dd8f9, the same diff (patch-id unchanged); #2881 touches none of this PR's files.

Rebased onto mod-api @ 75bcd270 (#2881 a mod adds a game language): head c098adff0 -> 1075dd8f9, the same diff (patch-id unchanged); #2881 touches none of this PR's files.
llun force-pushed fix/mod-api-win-sandbox-diagnostics from 1075dd8f9a
All checks were successful
PR description / Title and description (pull_request_target) Successful in 5s
to 32913bf0a7
All checks were successful
PR description / Title and description (pull_request_target) Successful in 6s
2026-11-30 19:37:54 +00:00
Compare
Author
Member

Rebased onto mod-api af3e4d40 (5 new commits on 75bcd270): head 32913bf0a, the same diff (patch-id unchanged). The new mod-api commits touch none of this PR's files.

Rebased onto mod-api af3e4d40 (5 new commits on 75bcd270): head 32913bf0a, the same diff (patch-id unchanged). The new mod-api commits touch none of this PR's files.
Author
Member

Closing: mod-api @ 65148a78 covers this. #2898 writes the diagnostic switches' folders on Windows too: files_rules::SWITCH_DIRS (the same five names as this PR's DIAGNOSTIC_DIRS) and the folders of the SWITCH_FILES, gathered in sandbox_windows/gather.rs as switch_dirs and written as builder-served roots. Like this PR, it never grants one at or above the game folder or at the program's folder, and the plan's own refusals (a drive's root, the never list, the record's folder, short names) still apply. A player's longshot_env.txt names no path (env_line::line_allowed), so those folders come from the real environment, or from a file it names with HOS_ENV_FILE.

One refusal this PR had that mod-api doesn't: a switch's folder inside a folder the plan only reads (the mods folder, a development mod, the RomFS, a part of the game folder) is still written there. Only the person running the game sets those switches. I'm leaving that to the write audit rather than reopening this PR, since the direction is that the game writes nothing itself.

Closing: `mod-api` @ 65148a78 covers this. [#2898](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2898) writes the diagnostic switches' folders on Windows too: `files_rules::SWITCH_DIRS` (the same five names as this PR's `DIAGNOSTIC_DIRS`) and the folders of the `SWITCH_FILES`, gathered in `sandbox_windows/gather.rs` as `switch_dirs` and written as builder-served roots. Like this PR, it never grants one at or above the game folder or at the program's folder, and the plan's own refusals (a drive's root, the never list, the record's folder, short names) still apply. A player's `longshot_env.txt` names no path (`env_line::line_allowed`), so those folders come from the real environment, or from a file it names with `HOS_ENV_FILE`. One refusal this PR had that `mod-api` doesn't: a switch's folder *inside* a folder the plan only reads (the mods folder, a development mod, the RomFS, a part of the game folder) is still written there. Only the person running the game sets those switches. I'm leaving that to the write audit rather than reopening this PR, since the direction is that the game writes nothing itself.
llun closed this pull request 2026-12-01 01:27:32 +00:00
All checks were successful
PR description / Title and description (pull_request_target) Successful in 6s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
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.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2847
No description provided.