Commit Graph

16181 Commits

Author SHA1 Message Date
John Ericson
c8d2bc72a5 Remove invalid release notes YAML field
There is no PR for this, since it was an embargoed fix before
disclosure.

(cherry picked from commit 32e67eba8b)
2024-07-03 20:02:23 +02:00
kn
4a42535dc0 Use proper struct sockpeercred for SO_PEERCRED for OpenBSD
getsockopt(2) documents this;  ucred is wrong ("cr_" member prefix, no pid).

(cherry picked from commit 10ccdb7a41)
2024-07-03 15:57:06 +00:00
John Ericson
2040540717 Ident some CPP in nix daemon
Makes it easier for me to read.

(cherry picked from commit a09360400b)
2024-07-03 15:57:06 +00:00
Eelco Dolstra
7891e56fb1 Bump version 2024-06-27 11:07:06 +02:00
tomberek
2b15b0b9b0
Merge pull request from GHSA-q82p-44mg-mgh5
Fix sandbox escape 2.20
2024-06-26 18:49:22 -04:00
Eelco Dolstra
caf4082dce Fix --no-sandbox
When sandboxing is disabled, we cannot put $TMPDIR underneath an
inaccessible directory.

(cherry picked from commit 86ca2d6d94c0581fda0c666c5e022784952f3542)
(cherry picked from commit 8f58b98770)
2024-06-21 16:39:44 +02:00
Eelco Dolstra
eee27e83e0 Formatting
(cherry picked from commit 3af22860759509d5040ff70618247031d96a095c)
2024-06-21 16:39:44 +02:00
Eelco Dolstra
879d814a75 Put the chroot inside a directory that isn't group/world-accessible
Previously, the .chroot directory had permission 750 or 755 (depending
on the uid-range system feature) and was owned by root/nixbld. This
makes it possible for any nixbld user (if uid-range is disabled) or
any user (if uid-range is enabled) to inspect the contents of the
chroot of an active build and maybe interfere with it (e.g. via /tmp
in the chroot, which has 1777 permission).

To prevent this, the root is now a subdirectory of .chroot, which has
permission 700 and is owned by root/root.

(cherry picked from commit af280e72fa0e62e1c2eaccfb992c0dbb6f27f895)
2024-06-21 16:39:44 +02:00
John Ericson
d3ca72cfd5
Merge pull request #10850 from NixOS/backport-10549-to-2.20-maintenance
[Backport 2.20-maintenance] Fix exportReferencesGraph when given store subpath
2024-06-04 06:46:39 -04:00
Alyssa Ross
f6b6c996a7 Fix exportReferencesGraph when given store subpath
With Nix 2.3, it was possible to pass a subpath of a store path to
exportReferencesGraph:

	with import <nixpkgs> {};

	let
	  hello = writeShellScriptBin "hello" ''
	    echo ${toString builtins.currentTime}
	  '';
	in

	writeClosure [ "${hello}/bin/hello" ]

This regressed with Nix 2.4, with a very confusing error message, that
presumably indicates it was unintentional:

	error: path '/nix/store/3gl7kgjr4pwf03f0x70dgx9ln3bhl7zc-hello/bin/hello' is not in the Nix store

(cherry picked from commit 0774e8ba33)
2024-06-04 10:26:19 +00:00
Robert Hensing
d78915d211
Merge pull request #10844 from NixOS/backport-9897-to-2.20-maintenance
[Backport 2.20-maintenance] libutil/url: fix git+file:./ parse error
2024-06-04 11:04:38 +02:00
Bryan Lai
7b39e21e77 libutil/url: fix git+file:./ parse error
Previously, the "file:./" prefix was not correctly recognized in
fixGitURL; instead, it was mistaken as a file path, which resulted in a
parsed url of the form "file://file:./".

This commit fixes the issue by properly detecting the "file:" prefix.
Note, however, that unlike "file://", the "file:./" URI is _not_
standardized, but has been widely used to referred to relative file
paths. In particular, the "git+file:./" did work for nix<=2.18, and was
broken since nix 2.19.0.

Finally, this commit fixes the issue completely for the 2.19 series, but
is still inadequate for the 2.20 series due to new behaviors from the
switch to libgit2. However, it does improve the correctness of parsing
even though it is not yet a complete solution.

(cherry picked from commit 8594f3cd5a)
2024-06-04 08:27:10 +00:00
github-actions[bot]
ab48ea416a
remove link to relocated manual page (#10705)
fix old anchor redirects to point to the correct location

(cherry picked from commit 45697ba502)

Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2024-05-15 22:41:14 +02:00
Robert Hensing
2cb5f579bf
Merge pull request #10671 from NixOS/backport-10588-to-2.20-maintenance
[Backport 2.20-maintenance] Fix fetchGit/fetchTree for nested submodules
2024-05-09 11:33:13 +02:00
Robert Hensing
630497bff7 Fix fetchGit nested submodules
(cherry picked from commit 750bcaa330)
2024-05-09 09:13:59 +00:00
Théophane Hufschmitt
bb8a4a3d0d Add a release note for the build-dir hardening 2024-04-22 15:34:48 +02:00
Théophane Hufschmitt
0e4baff868 Run the builds in a daemon-controled directory
Instead of running the builds under
`$TMPDIR/{unique-build-directory-owned-by-the-build-user}`, run them
under `$TMPDIR/{unique-build-directory-owned-by-the-daemon}/{subdir-owned-by-the-build-user}`
where the build directory is only readable and traversable by the daemon user.

This achieves two things:

1. It prevents builders from making their build directory world-readable
   (or even writeable), which would allow the outside world to interact
   with them.
2. It prevents external processes running as the build user (either
   because that somehow leaked, maybe as a consequence of 1., or because
   `build-users` isn't in use) from gaining access to the build
   directory.
2024-04-22 15:34:48 +02:00
Théophane Hufschmitt
cad14405c2 Add a test for the user sandboxing 2024-04-22 15:34:48 +02:00
Théophane Hufschmitt
fcdf99b5f5
Merge pull request #10459 from Ma27/backport-rl-2.20-changes
[2.20] Backport changes to release notes
2024-04-11 20:39:28 +02:00
Théophane Hufschmitt
1cf8c57990
Merge pull request #10471 from NixOS/backport-10456-to-2.20-maintenance
[Backport 2.20-maintenance] Fix adding symlink to the sandbox paths
2024-04-11 18:26:02 +02:00
Théophane Hufschmitt
ccb9779b96 Fix permission denied when building symlink derivation which points to a symlink out of the store
Bind-mounting symlinks is apparently not possible, which is why the
thing was failing.

Fortunately, symlinks are small, so we can fallback to copy them at no cost.

Fix https://github.com/NixOS/nix/issues/9579

Co-authored-by: Artturin <Artturin@artturin.com>
(cherry picked from commit 913db9f738)
2024-04-11 12:19:07 +00:00
Théophane Hufschmitt
f7146d25ec Add a test for depending on a symlink store path
Regression test for https://github.com/NixOS/nix/issues/9579

(cherry picked from commit 872d93eb13)
2024-04-11 12:19:07 +00:00
Maximilian Bosch
077bc08f9a
doc/rl-2.20: clarify builders-use-substitutes vs. substitute-on-destination
...as this lead to confusion before.

(cherry picked from commit 50557adb3b)
2024-04-11 14:18:10 +02:00
Maximilian Bosch
9e077b2d47
doc/rl-2.20: add missing entry about nix copy --to ssh-ng://...
This requires `--substitute-on-destination` if you want the remote side
to substitute instead of copying if possible.

For completeness sake, document it here.

Also, the stable Nix from nixpkgs is still 2.18, so more folks may
stumble upon this when this is bumped, so I'd expect this to be actually
useful.

Closes #10182

(cherry picked from commit f34b8de5b2)
2024-04-11 14:18:06 +02:00
Eelco Dolstra
202842e898
Merge pull request #10461 from NixOS/backport-10413-to-2.20-maintenance
[Backport 2.20-maintenance] path-info: print correct path when using `nix path-info --store file://... --all --json`
2024-04-10 22:49:22 +02:00
Maximilian Bosch
8b84348a78 path-info: print correct path when using nix path-info --store file://... --all --json
When querying all paths in a binary cache store, the path's representation
is `<hash>-x` (where `x` is the value of `MissingName`) because the .narinfo
filenames only contain the hash.

Before cc46ea1630 this worked correctly,
because the entire path info was read and the path from this
representation was printed, i.e. in the form `<hash>-<name>`. Since then
however, the direct result from `queryAllValidPaths()` was used as `path`.

Added a regression test to make sure the behavior remains correct.

(cherry picked from commit c80cd6bb06)
2024-04-10 17:37:36 +00:00
Rebecca Turner
7c6bd8b25f
Add release notes for "Functions are printed with more detail"
(cherry picked from commit abb5fef355)
2024-04-10 17:36:11 +02:00
Rebecca Turner
a383f3e408
Add release notes for "Nix no longer attempts to git add files that are .gitignored"
(cherry picked from commit 9a5d52262f)
2024-04-10 17:31:43 +02:00
Eelco Dolstra
c79d5195e5 Bump version 2024-04-05 17:24:37 +02:00
Eelco Dolstra
7bc4af7301
Merge pull request #10393 from NixOS/backport-10391-to-2.20-maintenance
[Backport 2.20-maintenance] Handle the case where a parent of ~/.nix-defexpr is a symlink
2024-04-03 18:52:21 +02:00
Eelco Dolstra
70a2c5f607 Handle the case where a parent of ~/.nix-defexpr is a symlink
Fixes https://github.com/DeterminateSystems/nix-installer/issues/912 and probably #10247.

(cherry picked from commit 09551fabd0)
2024-04-03 16:24:03 +00:00
Théophane Hufschmitt
59c629eb13
Merge pull request #10355 from NixOS/backport-10259-to-2.20-maintenance
[Backport 2.20-maintenance] doc: builtins.addDrvOutputDependencies: fix link target
2024-03-29 12:41:28 +01:00
Yueh-Shun Li
8bddaa14d4 builtins.addDrvOutputDependencies: fix commentary
(cherry picked from commit d2b512959c)
2024-03-29 10:56:46 +00:00
Yueh-Shun Li
34684db54d doc: builtins.addDrvOutputDependencies: fix link target
(cherry picked from commit 39b0b8452f)
2024-03-29 10:56:46 +00:00
Robert Hensing
ac9bedda2c
Merge pull request #10220 from lheckemann/backport-debugger-fix
[backport] fix debugger crashing while printing envs
2024-03-11 15:46:01 +01:00
pennae
631b2de30f fix debugger crashing while printing envs
fixes #9932

(cherry picked from commit 5ccb06ee1b)
2024-03-11 08:28:17 +01:00
Eelco Dolstra
fea2043060 GitHub fetcher: Ignore treeHash attribute for forward compatibility
See https://github.com/NixOS/nix/pull/10197.
2024-03-08 16:02:01 +01:00
Eelco Dolstra
02069f3058 Bump version 2024-03-07 16:49:52 +01:00
Eelco Dolstra
f8170ce9f1
Merge pull request from GHSA-2ffj-w4mj-pg37
Sandbox escape 2.20
2024-03-07 11:56:24 +01:00
Théophane Hufschmitt
d6918898c9 Add release notes 2024-03-07 09:38:54 +01:00
Théophane Hufschmitt
244f3eee0b Copy the output of fixed-output derivations before registering them
It is possible to exfiltrate a file descriptor out of the build sandbox
of FODs, and use it to modify the store path after it has been
registered.
To avoid that issue, don't register the output of the build, but a copy
of it (that will be free of any leaked file descriptor).
2024-03-07 09:38:51 +01:00
Théophane Hufschmitt
4645652975 Add a NixOS test for the sandbox escape
Test that we can't leverage abstract unix domain sockets to leak file
descriptors out of the sandbox and modify the path after it has been
registered.
2024-03-07 09:38:24 +01:00
Théophane Hufschmitt
584d64bebc
Merge pull request #10154 from intelfx/work/fix-null-deref
libfetchers/git: fix UB due to invalid usage of unique_ptr
2024-03-05 09:10:28 +01:00
Ivan Shapovalov
651e62781f libfetchers/git: use unique_ptr::get() instead of operator*()
According to N4950 20.3.1.3.5 [unique.ptr.single.observers]/1,
the behavior is undefined if get() == nullptr. Use get() instead of
operator*() on a possibly-null unique_ptr.

Fixes #10123.
2024-03-05 03:50:26 +01:00
Théophane Hufschmitt
82d7d740c9
Merge pull request #10142 from NixOS/backport-10073-to-2.20-maintenance
[Backport 2.20-maintenance] Accept multiple inputs in `nix flake update`
2024-03-04 10:31:19 +01:00
Olmo Kramer
b005d736ef Add test for nix flake update with multiple inputs
(cherry picked from commit b1ad729add)
2024-03-04 08:54:00 +00:00
Olmo Kramer
31c908a9e2 Accept multiple inputs in nix flake update
(cherry picked from commit 9f11b1b0c4)
2024-03-04 08:54:00 +00:00
Eelco Dolstra
b636f1ecd8 Bump version 2024-02-28 20:23:14 +01:00
Robert Hensing
edcb3430ef
Merge pull request #10102 from NixOS/backport-10044-to-2.20-maintenance
[Backport 2.20-maintenance] Handle empty Git repositories / workdirs
2024-02-28 03:00:35 +01:00
Eelco Dolstra
15c0a7b2ce Support empty Git repositories / workdirs
Fixes #10039.

(cherry picked from commit 9e762454cf)
2024-02-28 01:40:43 +00:00