-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stricter Network Sandbox on macOS #6049
Comments
Prefixes to block should be taken from a well maintained list like https://bgpfilterguide.nlnog.net/guides/bogon_prefixes/ |
Hm, why does enabling the sandbox break a lot of applications? |
My understanding is a lot of macOS applications have to find executables on the libraries on the host to successfully build, and that they cannot be provided purely. I've asked @abathur to weigh in. |
I don't have the best sense of scale (how many break), but I can give a concrete example: I just ran into an instance of NixOS/nixpkgs#82815 (review) the other day in qtpass while running nixpkgs-review. |
I've done a little bit of playing around with the current sandbox profiles we use in a VM running Big Sur 11.6.3. Even allowing local networking (by locally patching out the param check at nix/src/libstore/sandbox-defaults.sb Line 44 in 7c64a9d
# test.nix
let
pkgs = import <nixpkgs> { };
in
pkgs.runCommand "test"
{
buildInputs = with pkgs; [
curl
];
}
''
curl google.com
touch $out
'' nixos@nixoss-iMac-Pro nix % ./outputs/out/bin/nix-build test.nix
this derivation will be built:
/nix/store/lgwli1ks5n22s6snxvrjafmppx32bj6m-test.drv
building '/nix/store/lgwli1ks5n22s6snxvrjafmppx32bj6m-test.drv'...
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
/nix/store/sns084dvj9rh4yy3g0fspmi46ayizi5r-test (This is with One part of this ticket would probably be to investigate how to lock that down even further. (For any interested parties, I was able to find "some" reverse-engineered documentation on the |
This can be fixed with:
I tested these scenarios with netcat on MacOS 14.3.1 (23D60):
They had a similar issue in Bazel: bazelbuild/bazel#10068 I'll draft an MR when I find some time. Ideally the sandbox would have some sort of standalone integration tests without having to go through nix (daemon). |
Is your feature request related to a problem? Please describe.
Today, one of hydra.nixos.org's Macs on Hetzner got an abuse report threatening to shut down the server. What happened is the mac built an IPFS related package, started and IPFS server, and spammed the network with traffic. This was not a fixed output derivation.
As I understand it, enabling the full sandbox on macOS breaks building a lot of applications. Therefore, the macOS instances run with
sandbox = false
.Describe the solution you'd like
I'd like there to be a minimal sandbox which disables non-localhost network access when building non-FODs.
Describe alternatives you've considered
sandbox = true
and seeing if we can figure it out (but this sounds bad and not likely.)Additional context
n/a
The text was updated successfully, but these errors were encountered: