feat(sandbox)!: the sandbox is off by default #3132

Merged
HumanBean merged 1 commit from HumanBean/Longshot:feat/sandbox-off-default into main 2026-12-03 23:36:59 +00:00
Owner

Summary

The game's process sandbox is now off by default, on Linux and Windows. HOS_SANDBOX=1 (or on, true, yes)
confines the game as before, strict refuses to start unconfined; unset, 0 or any other word runs it unconfined.

This lowers security: by default the game, and every installed player's script mod (unsafe-tier ones included), can
do whatever the player's user account can. Script mods are not held when the sandbox is off.

Read first: host/sandbox_plan.h (sbx_mode_of), build_core sandbox_linux::mode_of and sandbox_windows::wanted,
longshot-game/src/runtime.rs confined(). Also: the Windows job queue's NVIDIA cache rule, the switch's row (now
player) and the docs.

Testing

Tested: Linux, no game run. Through the job queue: the test_sandbox_* checks, test_switch_table.py,
test_job_queue.py, cargo test for build-core and longshot-game. test_sandbox_linux.py passes after its helper
was set to ask for the sandbox (run again on its own). host/sandbox_windows.c passes an llvm-mingw syntax check.

Not clean:

  • test_sandbox_windows.py fails on "the builder says the needs and its notes in the game's hello": it looks for
    s.note.push(...), and the source, unchanged here, has s.note = note_lines(&said). Not run on a main checkout.
  • build-driver's the_repository_s_lock_and_the_table_agree fails; this PR touches neither tools.lock nor that
    crate. Not run on a main checkout. The run stopped there, so the rest of build-driver and longshot-builder may
    not have run.

Still to test:

  • Linux, any GPU: start the game with no HOS_SANDBOX and a script mod on, expecting sandbox: off in the log, the mod
    running, pads, saves and mod network working (by hand)
  • Windows: the same, expecting no AppContainer; saves and settings found, pipeline caches possibly rebuilt (by hand)
  • Linux and Windows: HOS_SANDBOX=1, expecting sandbox: confined as before (by hand)

Measurements

Nothing measured: a change of the sandbox's default, not run in game.

Risks

  • Security, as above. HOS_SANDBOX=1 restores the old behaviour; so does a revert.
  • Windows: a player's driver shader cache was kept in the AppContainer's folder; unconfined, the driver uses its usual
    one, so pipelines may compile again once.
  • The Mods tab on Windows now shows "Sandbox off" on its first line by default.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says. (not run in game: opened untested at the author's request)
  • mise run test passes (any failure that also fails on main is named). (not run whole; see Testing)
  • 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 switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def.
  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (no full game build)
  • Docs updated.
  • 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 The game's process sandbox is now **off by default**, on Linux and Windows. `HOS_SANDBOX=1` (or `on`, `true`, `yes`) confines the game as before, `strict` refuses to start unconfined; unset, `0` or any other word runs it unconfined. **This lowers security:** by default the game, and every installed player's script mod (unsafe-tier ones included), can do whatever the player's user account can. Script mods are not held when the sandbox is off. Read first: `host/sandbox_plan.h` (`sbx_mode_of`), `build_core` `sandbox_linux::mode_of` and `sandbox_windows::wanted`, `longshot-game/src/runtime.rs` `confined()`. Also: the Windows job queue's NVIDIA cache rule, the switch's row (now `player`) and the docs. ## Testing **Tested:** Linux, no game run. Through the job queue: the `test_sandbox_*` checks, `test_switch_table.py`, `test_job_queue.py`, `cargo test` for `build-core` and `longshot-game`. `test_sandbox_linux.py` passes after its helper was set to ask for the sandbox (run again on its own). `host/sandbox_windows.c` passes an llvm-mingw syntax check. Not clean: - `test_sandbox_windows.py` fails on "the builder says the needs and its notes in the game's hello": it looks for `s.note.push(...)`, and the source, unchanged here, has `s.note = note_lines(&said)`. Not run on a `main` checkout. - `build-driver`'s `the_repository_s_lock_and_the_table_agree` fails; this PR touches neither `tools.lock` nor that crate. Not run on a `main` checkout. The run stopped there, so the rest of `build-driver` and `longshot-builder` may not have run. **Still to test:** - Linux, any GPU: start the game with no `HOS_SANDBOX` and a script mod on, expecting `sandbox: off` in the log, the mod running, pads, saves and mod network working (by hand) - Windows: the same, expecting no AppContainer; saves and settings found, pipeline caches possibly rebuilt (by hand) - Linux and Windows: `HOS_SANDBOX=1`, expecting `sandbox: confined` as before (by hand) ## Measurements Nothing measured: a change of the sandbox's default, not run in game. ## Risks - Security, as above. `HOS_SANDBOX=1` restores the old behaviour; so does a revert. - Windows: a player's driver shader cache was kept in the AppContainer's folder; unconfined, the driver uses its usual one, so pipelines may compile again once. - The Mods tab on Windows now shows "Sandbox off" on its first line by default. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [ ] Tested on my own PC, in the game for a change the game runs, as Testing says. (not run in game: opened untested at the author's request) - [ ] `mise run test` passes (any failure that also fails on `main` is named). (not run whole; see Testing) - [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 switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. - [x] A check under `tests/` that reads changed source is updated, not weakened. - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (no full game build) - [x] Docs updated. - [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)
feat(sandbox)!: the sandbox is off by default; HOS_SANDBOX=1 turns it on
Some checks failed
CI / What the change needs (pull_request) Successful in 8s
CI / Third-party parts and guide screenshots (pull_request) Successful in 12s
PR description / Title and description (pull_request_target) Failing after 6s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 18s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 1m25s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 11m21s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 13m8s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 12m7s
CI / Website build and checks (pull_request) Failing after 1m13s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 52m36s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1h0m5s
34274e5e50
Unset, 0 or an unknown word now runs the game and players' script mods
unconfined; 1 confines as before, strict refuses to start unconfined.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Member

Possibly related, for context:

  • PR #3106 WIP: fix(sandbox): the title bar on GNOME is libdecor's Cairo plugin, so GTK no longer aborts the game — Open Linux sandbox-related work; may interact with sandbox mode behavior.
  • PR #3093 feat(sandbox): add-ons work in the sandbox on Linux and Windows, and every refusal says who asked — Recently merged add-on sandbox rules this change now defaults away from.
Possibly related, for context: - PR #3106 WIP: fix(sandbox): the title bar on GNOME is libdecor's Cairo plugin, so GTK no longer aborts the game — Open Linux sandbox-related work; may interact with sandbox mode behavior. - PR #3093 feat(sandbox): add-ons work in the sandbox on Linux and Windows, and every refusal says who asked — Recently merged add-on sandbox rules this change now defaults away from.
HumanBean changed title from WIP: feat(sandbox)!: the sandbox is off by default to feat(sandbox)!: the sandbox is off by default 2026-12-03 23:36:52 +00:00
HumanBean deleted branch feat/sandbox-off-default 2026-12-03 23:36:59 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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!3132
No description provided.