feat(sandbox): Windows Job Object backend (process-tree isolation) - #149
Closed
raymondginger2018-sudo wants to merge 1 commit into
Closed
feat(sandbox): Windows Job Object backend (process-tree isolation)#149raymondginger2018-sudo wants to merge 1 commit into
raymondginger2018-sudo wants to merge 1 commit into
Conversation
Native Windows previously reported backend 'none', so shell and code-mode commands ran without any isolation. This adds a real Windows isolation primitive — a Job Object with JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE: - When the wrapper process exits (normally or killed), the entire child process tree is terminated: no orphaned shells/compilers survive. - The inner command is spawned suspended (CreateProcessW), assigned to the job, then resumed; every descendant joins the same job automatically (Windows jobs are hierarchical). - Exit code is forwarded so callers see the inner command's result. Wiring mirrors the seatbelt/bwrap backends: sandbox_backend() returns 'job' on Windows and wrap_argv_command prefixes the inner argv with 'python -m core.harness.windows_sandbox --'. Pure ctypes, no third-party dependency; degrades to a subprocess passthrough if any Win32 call fails. Honest boundary documented in the module: this provides process-tree isolation and lifetime guarantees, not a filesystem write-fence (which on Windows requires disk quotas or AppContainer/SILO privileges). Tests: exit-code forwarding, wrapper wiring via build_exec_command, and a KILL_ON_JOB_CLOSE descendant-kill smoke test (Windows only). seatbelt profile tests are now correctly skipped off-Darwin.
Collaborator
|
Merged as This is now validated on real Windows: I extended the Two things I appreciated in the review: the backend does not pretend to provide a write-fence, and the docstring says so plainly. I built on that — |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Native Windows previously reported sandbox backend
none, so shell and code-mode commands ran with no isolation. This adds a real Windows isolation primitive — a Job Object withJOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE.What it provides
CreateProcessW), assigned to the job, resumed; all descendants join automatically.sandbox_backend()returnsjobon Windows;wrap_argv_commandprefixespython -m core.harness.windows_sandbox --.Honest boundary
This provides process-tree isolation and lifetime guarantees, not a filesystem write-fence (which on Windows needs disk quotas or AppContainer/SILO privileges). Documented in the module.
Tests
Windows-only: exit-code forwarding, wrapper wiring via
build_exec_command, and a KILL_ON_JOB_CLOSE descendant-kill smoke test. seatbelt profile tests are now correctly skipped off-Darwin.