Repository navigation
Conversation
network.allowAllUnixSockets is the only way to let a sandboxed command create Unix sockets on Linux, and it removes apply-seccomp altogether. Besides AF_UNIX, that drops the AF_VSOCK and io_uring blocks, the helper's PID namespace, the namespaces filter and write-violation monitoring. allowUnixSocketCreation keeps the helper and leaves out only the AF_UNIX rule. The generator gains a `vsock` rule set (`unix` without AF_UNIX), which apply-seccomp installs in place of `unix` when SRT_ALLOW_UNIX_SOCKETS=1. The variable is set and cleared the same way as SRT_ALLOW_NESTED_USERNS. The `unix` and `namespaces` filters are byte-for-byte unchanged. A sandbox nested inside srt needs this: srt itself, or Claude Code with its sandbox on. The inner srt creates the Unix sockets its proxies are bridged through. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
@ronleizrowice-ant this follows the |
This branch has not been deployed
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.
Closes #796
Problem
On Linux,
network.allowAllUnixSockets: trueis the only way to let a sandboxed command create Unix sockets, and it skipsapply-seccompentirely. Besides allowingAF_UNIX, that also:AF_VSOCK(documented in the option's description);namespacesfilter (--disable-usernsstill applies where bubblewrap supports it);USER_NOTIFobserver is installed by the helper.The case that needs Unix sockets is a sandbox nested inside srt: srt itself, or Claude Code with its sandbox on. The inner srt has to create the Unix socket it bridges its proxies through. With today's options, an outer srt can only allow that by giving up everything above.
Change
seccomp-unix-block.cgains avsockrule set:unixwithout theAF_UNIXrule.apply-seccompreadsSRT_ALLOW_UNIX_SOCKETSonce, as it doesSRT_ALLOW_NESTED_USERNS.1, it installsvsockin place ofunix.network.allowUnixSocketCreation(Linux only; ignored whenallowAllUnixSocketsis true).--unsetenv, the same way asSRT_ALLOW_NESTED_USERNS.allowAllUnixSocketsis unchanged. The README presents it as the way to run without the helper, for example on unsupported architectures.Compatibility: with the option off, nothing changes. The generated
unixandnamespacesfilters are byte-for-byte identical to v0.0.81 (checked on x86_64).Question for maintainers
Would you rather
allowAllUnixSocketsitself kept the helper? That is arguably what the name promises. I made a separate opt-in because changing it would alter behaviour for existing users, including anyone relying on it to skip the helper.Testing
All on Ubuntu 24.04 under WSL2 (kernel 6.6), x86_64, Bun 1.4.2. Written against v0.0.81, then rebased onto
main(98a4016), where the six related test files pass: 221 tests, 0 failures.New tests:
test/sandbox/seccomp-unix-socket-creation.test.ts(8 tests) covers:1versus other values, and removal of the variable;--unsetenv;SandboxManagerin a network-restricted sandbox.5 of the 8 fail against the v0.0.81 helper.
Config validation: a test that the option is a boolean and absent unless given.
Full suite: 4064 pass, 78 fail. The same 78 tests fail without this change, all in 7 files that don't touch this code:
rules-through-links-on-every-runtime,control-fd,credential-mask*,tls-terminate-tunnel-ends,default-write-paths. They look environment-related.Nesting: Claude Code (2.1.280) with
sandbox.enabledandfailIfUnavailable: true, inside srt withallowUnixSocketCreationandallowNestedUserNamespaces./tmp, which the outer policy allows, is refused.AF_VSOCKand io_uring.EPERM ... listen srt-mux-*.sockand refuses to run Bash.WSL2: a Windows executable in a writable directory runs on the host through interop under
allowAllUnixSockets. UnderallowUnixSocketCreation, interop fails atUtilBindVsockAnyPort: socket failed.Not tested: arm64 (the
vsockfilter for aarch64 generates, but no arm64 build was run), and macOS (the option is ignored there).🤖 Generated with Claude Code