6 Commits
Author SHA1 Message Date
Caroline ZhuandgVisor bot 66cc4a13d1 Replace boolean networking flag with NetworkMode enum in SandboxExec bindings.
This change refactors how network isolation is configured in both the Go and
Python sandbox APIs. Instead of a boolean enable/disable flag, a new
NetworkMode enum (supporting "none", "host", and "sandbox") is introduced.

PiperOrigin-RevId: 967507724
2026-08-19 18:10:46 -07:00
Caroline ZhuandgVisor bot 98cf192ad4 Add support for custom mounts in Python SandboxExec.
Add support for custom directory mounts (bind mounts, in-memory tmpfs mounts,
and procfs mounts) to the Python SandboxExec bindings (gvisor.sandbox).

Features introduced:
- Mount dataclass with factory methods:
  Mount.bind(source, destination, readonly=False),
  Mount.tmpfs(destination), and Mount.proc(destination).
- MountType enum supporting 'bind', 'tmpfs', and 'proc'.
- _normalize_mounts private module-level helper function to validate and
  normalize mount configurations from Mount instances or dictionary
  definitions.
- mounts parameter in Sandbox.__init__ to configure container mounts in OCI
  config.json spec.
- Exported Mount and MountType in gvisor package root.
- Comprehensive unit and integration tests covering read-only bind mounts,
  read-write bind mounts, tmpfs, proc mounts, dictionary configuration,
  validation error cases, and Mount factory methods.

PiperOrigin-RevId: 964427990
2026-08-13 19:38:09 -07:00
Caroline ZhuandgVisor bot a8a3819cd1 Add support for custom working directory in Python SandboxExec.
Add support for configuring the container working directory and per-command
working directory overrides in the Python SandboxExec bindings (gvisor.sandbox).

Features introduced:
- Added working_dir parameter to Sandbox.__init__ to configure the initial
  working directory inside the container (written to spec.process.cwd in
  config.json). Defaults to "/".
- Added _normalize_working_dir private module-level helper to normalize and
  validate working directory paths into absolute POSIX paths.
- Added cwd parameter to Sandbox.exec to support per-command execution directory
  overrides via the '--cwd' flag passed to runsc exec.
- Added comprehensive unit test coverage for default/unset working_dir, custom
  paths, relative path normalization, invalid values, and exec cwd overrides.

PiperOrigin-RevId: 963705877
2026-08-12 15:57:59 -07:00
Caroline ZhuandgVisor bot 39a97aeccf Support passing environment variables to Python SandboxExec bindings.
PiperOrigin-RevId: 961115952
2026-08-07 14:23:15 -07:00
Caroline ZhuandgVisor bot 2a3c70cd70 Add support for custom network modes in Python SandboxExec.
PiperOrigin-RevId: 960325662
2026-08-06 08:48:45 -07:00
Caroline ZhuandgVisor bot 26680d69e1 Add set-up for packaging existing Python runsc bindings into a wheel.
You can see the preview for the PyPI description that will be generated at
https://test.pypi.org/project/gvisor/0.1.1/

PiperOrigin-RevId: 951030924
2026-07-20 13:47:25 -07:00