summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorrnhmjoj <rnhmjoj@inventati.org>2023-09-08 08:58:31 +0200
committerrnhmjoj <rnhmjoj@inventati.org>2023-09-08 09:15:50 +0200
commitc945723356c17f0570217dedefac645721d6fb70 (patch)
tree4f19f981897320a50e0fb2a1f8d606ed30337cce /pkgs/build-support
parentef14cdd5b929963d9117def6cc888a1444de5541 (diff)
downloadnixpkgs-c945723356c17f0570217dedefac645721d6fb70.tar
nixpkgs-c945723356c17f0570217dedefac645721d6fb70.tar.gz
nixpkgs-c945723356c17f0570217dedefac645721d6fb70.tar.bz2
nixpkgs-c945723356c17f0570217dedefac645721d6fb70.tar.lz
nixpkgs-c945723356c17f0570217dedefac645721d6fb70.tar.xz
nixpkgs-c945723356c17f0570217dedefac645721d6fb70.tar.zst
nixpkgs-c945723356c17f0570217dedefac645721d6fb70.zip
buildFHSEnv: disable security features by default
The implicit contract of buildFHSUserEnv was that it allows to run
software built for a typical GNU/Linux distribution (not NixOS) without
patching it (patchelf, autoPatchelfHook, etc.). Note that this does not
inherently imply running untrusted programs.

buildFHSUserEnv was implemented by using chroot and assembling a
standard-compliant FHS environment in the new root. As expected, this
did not provide any kind of isolation between the system and the
programs.

However, when it was later reimplemented using bubblewrap
(PR #225748), which *is* a security tool, several isolation features
involving detaches Linux namespaces were turned on by default.
This decision has introduced a number of breakages that are very
difficult to debug and trace back to this change.
For example: `unshareIPC` breaks software audio mixing in programs using
ALSA (dmix) and `unsharePID` breaks gdb,

Since:

  1. the security features were enable without any clear threat model;
  2. `buildFHSEnvBubblewrap` is supposed to be a drop-in replacement of
     `buildFHSEnvChrootenv` (see the release notes for NixOS 23.05);
  3. the change is breaking in several common cases (security does not
     come for free);
  4. the contract was not changed, or at least communicated in a clear
     way to the users;

all security features should be turned off by default.

P.S. It would be useful to create a variant of buildFHSEnv that does
provide some isolation. This could unshare some namespaces and mount
only limited parts of the filesystem.
Note that buildFHSEnv mounts every directory in / under the new root, so
again, very little is gained by unsharing alone.
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/build-fhsenv-bubblewrap/default.nix10
1 files changed, 5 insertions, 5 deletions
diff --git a/pkgs/build-support/build-fhsenv-bubblewrap/default.nix b/pkgs/build-support/build-fhsenv-bubblewrap/default.nix
index 6c9b71624c2..5e8894d7cb3 100644
--- a/pkgs/build-support/build-fhsenv-bubblewrap/default.nix
+++ b/pkgs/build-support/build-fhsenv-bubblewrap/default.nix
@@ -17,12 +17,12 @@
 , meta ? {}
 , passthru ? {}
 , extraBwrapArgs ? []
-, unshareUser ? true
-, unshareIpc ? true
-, unsharePid ? true
+, unshareUser ? false
+, unshareIpc ? false
+, unsharePid ? false
 , unshareNet ? false
-, unshareUts ? true
-, unshareCgroup ? true
+, unshareUts ? false
+, unshareCgroup ? false
 , dieWithParent ? true
 , ...
 } @ args: