24 Commits
Author SHA1 Message Date
Jing Chen 5867605e80 Make the bwrap alias a wrapper around the sandboxexec Go bindings.
bwrap previously built its own specs.Spec, wrote an OCI bundle and drove
runsc/container directly. It now only parses the bubblewrap command line
and translates it into sandbox.Options; //sandboxexec/sandbox owns the
bundle, the runsc invocation and the container lifecycle.
2026-08-31 01:51:10 +00:00
Etienne PerotandgVisor bot 4e53fafea2 Use //:release rather than //runsc target for all gVisor test usage
PiperOrigin-RevId: 973178774
2026-08-29 12:57:17 -07:00
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 b394683495 Add support for custom hostnames and procfs mounts in sandboxexec Go bindings.
PiperOrigin-RevId: 954751454
2026-07-27 11:56:04 -07:00
Caroline ZhuandgVisor bot 0201ced0cf Add SandboxExec Go binding for sandbox working directory
PiperOrigin-RevId: 952934899
2026-07-23 13:49:49 -07:00
Jing ChenandgVisor bot b01ed13618 Implement runsc rootfs snapshot in runsc go binding.
PiperOrigin-RevId: 951062826
2026-07-20 14:45:32 -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
Caroline ZhuandgVisor bot 88372e8beb Add support for setting environment variables in the Go SandboxExec bindings.
PiperOrigin-RevId: 949754625
2026-07-17 14:13:47 -07:00
Jing ChenandgVisor bot 0fdbec752d Add a unified gVisor checkpoint/restore API.
The change doens't have actual implementation. It demonstrates
the API design on how runsc go binding does checkpoint and restore.

The API aims to unify all 3 existing gVisor snapshot/checkpoint
methods.

PiperOrigin-RevId: 948000243
2026-07-14 17:45:31 -07:00
Jing ChenandgVisor bot 5de5c8acfb Add python language binding for runsc.
PiperOrigin-RevId: 944118949
2026-07-07 15:18:49 -07:00
Caroline ZhuandgVisor bot 66653489a4 Add support for custom bind and tmpfs mounts in sandboxexec.
PiperOrigin-RevId: 940001068
2026-06-29 13:33:39 -07:00
Jing ChenandgVisor bot dd198bdefe Relocate go_binding_test to sandbox_test.
The test doesn't need root now, add runsc as data dependency for
the test execution.

PiperOrigin-RevId: 932840499
2026-06-15 21:02:14 -07:00
Jing ChenandgVisor bot 480c0d9129 Support rootless execution in runsc Go binding
- Add UserNamespace, single-UID mapping, and remove NetworkNamespace when
  non-root.
- Append --ignore-cgroups and --network=none when non-root.

It limites how we use the networking, if the networking is needed, it will
need sudo, alternatively, users can specify host network with rootless.

PiperOrigin-RevId: 926214126
2026-06-03 13:01:18 -07:00
Lucas ManningandgVisor bot dc9463e046 Add README for sandboxexec, marking it as experimental.
Assisted-by: Jetski
PiperOrigin-RevId: 922363001
2026-05-27 15:07:38 -07:00
281c308eb7 Refactor Sandbox.New to use functional options and expose Bundle() accessor.
- Refactored `sandbox.New` to accept functional options
  (`WithRuntimeDir`, `WithID`).
- Eliminated package-level `init()` side effects and hardcoded `/tmp`
  static paths, allowing hermetic test configuration and overriding
  the runtime directory.
- Added `Bundle()` method to expose the Sandbox's underlying OCI
  bundle directory path.
- Extended `TestSandboxOptions` to verify custom `runtimeDir` overriding
  and bundle path prefix matching.

PiperOrigin-RevId: 911095748

Co-authored-by: Hanzo Dev <[email protected]>
2026-05-05 21:46:42 -07:00
Lucas ManningandgVisor bot 252d886f8b Create the sandboxexec subcommand.
PiperOrigin-RevId: 908266872
2026-04-30 10:59:06 -07:00
Jing ChenandgVisor bot 5866468763 Update OCI bundle to make sure runsc go binding works on arm64.
On most modern arm64 (AArch64) Linux distributions, the /lib64 directory
does not exist because the system libraries are purely 64-bit and reside
directly in /lib.

PiperOrigin-RevId: 907969863
2026-04-29 23:09:36 -07:00
Jing ChenandgVisor bot f56fec8795 Add runsc Go binding API prototype.
PiperOrigin-RevId: 906568393
2026-04-27 15:16:25 -07:00
Lucas ManningandgVisor bot f55248df90 Fix new sandbox_options proto build.
PiperOrigin-RevId: 878013302
2026-03-03 10:25:12 -08:00
Lucas ManningandgVisor bot 80b9e57bf2 Create initial sandbox configuration spec.
This configuration will serve as the base for various language-specific
sandbox APIs.

PiperOrigin-RevId: 877625759
2026-03-02 16:19:25 -08:00