Commit Graph

16570 Commits

Author SHA1 Message Date
Eelco Dolstra
ba13559bd9 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:16:17 +02:00
John Ericson
520a66f201
Merge pull request #10851 from NixOS/backport-10549-to-2.21-maintenance
[Backport 2.21-maintenance] Fix exportReferencesGraph when given store subpath
2024-06-04 06:50:42 -04:00
Alyssa Ross
5342d27f0b 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:20 +00:00
Robert Hensing
46b6cfbfc6
Merge pull request #10845 from NixOS/backport-9897-to-2.21-maintenance
[Backport 2.21-maintenance] libutil/url: fix git+file:./ parse error
2024-06-04 11:09:18 +02:00
Bryan Lai
03eb7111fa 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:12 +00:00
Eelco Dolstra
1ebc34e9c5
Merge pull request #10720 from NixOS/backport-10675-to-2.21-maintenance
[Backport 2.21-maintenance] Handle zip files containing symlinks
2024-05-16 09:51:47 +02:00
github-actions[bot]
1248da4423
remove link to relocated manual page (#10706)
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:26 +02:00
github-actions[bot]
3c10c6f15d
Revert "manual: fold sidebar sections" (#10699)
(cherry picked from commit 937e7bae48)

Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2024-05-15 22:40:44 +02:00
Eelco Dolstra
6f6a772da6 Handle zip files containing symlinks
In streaming mode, libarchive doesn't handle symlinks in zip files
correctly. So write the entire file to disk so libarchive can access
it in random-access mode.

Fixes #10649. This was broken in cabee98152.

(cherry picked from commit 9951e14ae0)
2024-05-15 20:07:38 +00:00
Robert Hensing
375acc48ea
Merge pull request #10670 from NixOS/backport-10588-to-2.21-maintenance
[Backport 2.21-maintenance] Fix fetchGit/fetchTree for nested submodules
2024-05-09 11:32:38 +02:00
Robert Hensing
7d1af2cf79 Fix fetchGit nested submodules
(cherry picked from commit 750bcaa330)
2024-05-09 09:09:37 +00:00
Théophane Hufschmitt
8a91b5e1bc Add a release note for the build-dir hardening 2024-04-22 15:30:52 +02:00
Théophane Hufschmitt
64d7f56eaa 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:30:50 +02:00
Théophane Hufschmitt
1b8ff553bd Add a test for the user sandboxing 2024-04-22 15:27:32 +02:00
Théophane Hufschmitt
93e8660bba
Merge pull request #10529 from NixOS/backport-10467-to-2.21-maintenance
[Backport 2.21-maintenance] nix shell: Handle output paths that are symlinks
2024-04-17 16:12:10 +02:00
Eelco Dolstra
b1044d52ce nix shell: Test that store paths cannot link outside of the store
(cherry picked from commit 26a4688a86)
2024-04-17 13:25:06 +00:00
Eelco Dolstra
c8905a8747 Doh
(cherry picked from commit 9d50f57fa3)
2024-04-17 13:25:06 +00:00
Eelco Dolstra
3e138de2e0 nix shell: Handle output paths that are symlinks
This requires moving resolveSymlinks() into SourceAccessor. Also, it
requires LocalStoreAccessor::maybeLstat() to work on parents of the
store (to avoid an error like "/nix is not in the store").

Fixes #10375.

(cherry picked from commit 85b9f4ef4f)
2024-04-17 13:25:06 +00:00
Théophane Hufschmitt
60824fa97c
Merge pull request #10475 from tweag/backport-10244-to-2.21-maintenance
Backport #10244 to 2.21 maintenance
2024-04-11 17:29:58 +02:00
Bouke van der Bijl
d5e029a62e Add nixos test
(cherry picked from commit cd06193d13)
2024-04-11 17:00:15 +02:00
Bouke van der Bijl
ed6dc569bb Set the origin instead of hacking in the URL resolving
(cherry picked from commit 1a76ca4161)
2024-04-11 17:00:15 +02:00
Bouke van der Bijl
3f2150dcd1 git fetcher: relax absolute URL check of resolveSubmoduleUrl
This matches up the behavior with the internals of libgit2

Fixes #9979

(cherry picked from commit 1f73de2629)
2024-04-11 17:00:15 +02:00
Théophane Hufschmitt
0c1fcc2a97
Merge pull request #10470 from NixOS/backport-10456-to-2.21-maintenance
[Backport 2.21-maintenance] Fix adding symlink to the sandbox paths
2024-04-11 15:14:48 +02:00
Théophane Hufschmitt
4c7f69f531 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:17:37 +00:00
Théophane Hufschmitt
2e93272f19 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:17:36 +00:00
John Ericson
45b2789dc8
Merge pull request #10466 from NixOS/backport-10458-to-2.21-maintenance
[Backport 2.21-maintenance] doc/rl-2.20: clarify builders-use-substitutes vs. substitute-on-destion
2024-04-11 03:16:31 -04:00
Maximilian Bosch
a643aeccd3 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-10 21:26:20 +00:00
Eelco Dolstra
c80068c099
Merge pull request #10462 from NixOS/backport-10413-to-2.21-maintenance
[Backport 2.21-maintenance] path-info: print correct path when using `nix path-info --store file://... --all --json`
2024-04-10 22:32:34 +02:00
Maximilian Bosch
cb7beb05cd 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:39 +00:00
Théophane Hufschmitt
b433176028
Merge pull request #10452 from NixOS/backport-10449-to-2.21-maintenance
[Backport 2.21-maintenance] doc/rl-2.20: add missing entry about `nix copy --to ssh-ng://...`
2024-04-10 12:41:11 +02:00
Maximilian Bosch
9fe8513e3a 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-10 09:44:51 +00:00
Eelco Dolstra
bd2c466b46 Bump version 2024-04-05 17:24:14 +02:00
Eelco Dolstra
355cbc482f
Merge pull request #10392 from NixOS/backport-10391-to-2.21-maintenance
[Backport 2.21-maintenance] Handle the case where a parent of ~/.nix-defexpr is a symlink
2024-04-03 18:18:57 +02:00
Eelco Dolstra
56555e584f 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 15:20:54 +00:00
Eelco Dolstra
92e38fe30c
Merge pull request #10384 from NixOS/backport-10340-to-2.21-maintenance
[Backport 2.21-maintenance] Add trust-tarballs-from-git-forges setting
2024-04-03 11:48:19 +02:00
Eelco Dolstra
b77b2c22c1 Add test
(cherry picked from commit 00ce36fafe)
2024-04-02 16:06:10 +00:00
Eelco Dolstra
162cc2a180 Add trust-tarballs-from-git-forges setting
If enabled, GitHub flakerefs don't require a content hash, a Git
revision is enough.

Fixes #10297.

(cherry picked from commit 46d9e70c20)
2024-04-02 16:06:10 +00:00
Eelco Dolstra
542b9eff07
Merge pull request #10356 from NixOS/backport-10259-to-2.21-maintenance
[Backport 2.21-maintenance] doc: builtins.addDrvOutputDependencies: fix link target
2024-03-29 13:21:51 +01:00
Yueh-Shun Li
4e9c7e7a3d builtins.addDrvOutputDependencies: fix commentary
(cherry picked from commit d2b512959c)
2024-03-29 10:56:48 +00:00
Yueh-Shun Li
0d8e2679a5 doc: builtins.addDrvOutputDependencies: fix link target
(cherry picked from commit 39b0b8452f)
2024-03-29 10:56:48 +00:00
Eelco Dolstra
2d1cb49095 Bump version 2024-03-26 18:56:51 +01:00
Théophane Hufschmitt
3272ed0d58
Merge pull request #10328 from NixOS/backport-10325-to-2.21-maintenance
[Backport 2.21-maintenance] build-remote: fix format string shenanigans
2024-03-26 15:04:01 +01:00
K900
fb25bdc7b7 build-remote: fix format string shenanigans
HintFmt(string) invokes the HintFmt("%s", literal) constructor,
which is not what we want here. Add a constructor with a proper name
and call that.

Next step: rename all the other ones to HintFmt::literal(string).

Fixes https://github.com/NixOS/nix/issues/10238

(cherry picked from commit 2d4edb945b)
2024-03-26 13:35:06 +00:00
Robert Hensing
53440f4edf
Merge pull request #10309 from NixOS/backport-10293-to-2.21-maintenance
[Backport 2.21-maintenance] EvalCache: Fix missing format string argument
2024-03-24 02:54:31 +01:00
Eelco Dolstra
9e35746360 EvalCache: Fix missing format string argument
Fixes

  terminate called after throwing an instance of 'boost::wrapexcept<boost::io::too_few_args>'
    what():  boost::too_few_args: format-string referred to more arguments than were passed
  Aborted (core dumped)

for type errors in AttrCursor.

(cherry picked from commit bfd36402ac)
2024-03-24 01:28:27 +00:00
Eelco Dolstra
057ffc2e8e Bump version 2024-03-11 21:15:30 +01:00
Eelco Dolstra
34807c8906 Mark official release 2024-03-11 18:34:29 +01:00
Eelco Dolstra
72e145e415
Merge pull request #10226 from edolstra/release-notes
Release notes
2024-03-11 18:32:51 +01:00
Eelco Dolstra
4c97a66b4c Tweak release notes 2024-03-11 18:00:10 +01:00
Eelco Dolstra
b12dc76cfc release notes: 2.21.0 2024-03-11 16:22:29 +01:00