Skip to content

Commit 8a13201

Browse files
committed
log networking status when running in sandbox
1 parent 5573bc7 commit 8a13201

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Sandbox backends:
3636

3737
1. **Flatpak-spawn** — uses `flatpak-spawn --sandbox` to create a sub-sandbox within the Flatpak container. Supports environment variable forwarding (`--env`), working directory (`--directory`), and optional network isolation via `SandboxConfig.NoNetwork` (`--no-network`). The `--watch-bus` flag ties the sandboxed process lifetime to the caller's session bus.
3838

39-
2. **Bubblewrap** — uses [bubblewrap](https://github.com/containers/bubblewrap) to create a lightweight user-namespace sandbox. Mounts system directories read-only, bind-mounts the game's install folder read-write, and forwards display/audio sockets (X11, Wayland, PulseAudio, PipeWire). Namespace isolation covers user, PID, and UTS; IPC stays shared for X11 MIT-SHM compatibility. Network access is shared by default, with optional isolation via `SandboxConfig.NoNetwork`.
39+
2. **Bubblewrap** — uses [bubblewrap](https://github.com/containers/bubblewrap) to create a lightweight user-namespace sandbox. Mounts system directories read-only, bind-mounts the game's install folder read-write, and forwards display/audio sockets (X11, Wayland, PulseAudio, PipeWire). The in-sandbox `HOME` path is backed by a per-game persistent directory at `{InstallFolder}/.itch/home`, so game saves written under home survive across launches. Namespace isolation covers user, PID, and UTS; IPC stays shared for X11 MIT-SHM compatibility. Network access is shared by default, with optional isolation via `SandboxConfig.NoNetwork`.
4040

4141
3. **Firejail** — uses [firejail](https://firejail.wordpress.com/) with a generated profile at `{InstallFolder}/.itch/isolate-app.profile` that blacklists sensitive directories and whitelists the game's install folder and temp directory. Environment forwarding follows the same allowlist baseline as bubblewrap (including itch launch vars and temp vars), supports additional passthrough via `SandboxConfig.AllowEnv`, and network access can be disabled with `SandboxConfig.NoNetwork`. Per-game local overrides can be placed in `/etc/firejail/` (e.g. `itch_game_{name}.local`), and a global override file `itch_games_globals.local` is also included if present.
4242

runner/bubblewrap_linux.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ func (br *bubblewrapRunner) Run() error {
3838
consumer := params.Consumer
3939

4040
bwrapPath := params.BubblewrapParams.BinaryPath
41-
consumer.Opf("Running (%s) through bubblewrap", params.FullTargetPath)
41+
msg := fmt.Sprintf("Running (%s) through bubblewrap", params.FullTargetPath)
42+
if params.SandboxConfig.NoNetwork {
43+
msg += " (networking disabled)"
44+
}
45+
consumer.Opf("%s", msg)
4246

4347
var args []string
4448

runner/firejail_linux.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ func (fr *firejailRunner) Run() error {
6464
return fmt.Errorf("%w", err)
6565
}
6666

67-
consumer.Opf("Running (%s) through firejail", params.FullTargetPath)
67+
msg := fmt.Sprintf("Running (%s) through firejail", params.FullTargetPath)
68+
if params.SandboxConfig.NoNetwork {
69+
msg += " (networking disabled)"
70+
}
71+
consumer.Opf("%s", msg)
6872

6973
var args []string
7074
args = append(args, fmt.Sprintf("--profile=%s", sandboxProfilePath))

runner/flatpakspawn_linux.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ func (fr *flatpakSpawnRunner) Run() error {
4242
params := fr.params
4343
consumer := params.Consumer
4444

45-
consumer.Opf("Running (%s) through flatpak-spawn --sandbox", params.FullTargetPath)
45+
msg := fmt.Sprintf("Running (%s) through flatpak-spawn --sandbox", params.FullTargetPath)
46+
if params.SandboxConfig.NoNetwork {
47+
msg += " (networking disabled)"
48+
}
49+
consumer.Opf("%s", msg)
4650

4751
var args []string
4852
args = append(args, "--sandbox")

0 commit comments

Comments
 (0)