DetSys seems to have made a security release to NixCpp.
The primary risk is leaking of netrc credentials through a crafted derivation plus an attacker-in-the-middle. Users of the experimental feature
impure-derivationsare at greater risk.
FlakeHub Cache users and users of impure derivations should upgrade as soon as possible.
source: https://x.com/DeterminateSys/status/1839145876486242659
Here’s the contents of the related security advisor: Credential leak when credentials are used with `<nix/fetchurl.nix>` · Advisory · NixOS/nix · GitHub
Credential leak when credentials are used with <nix/fetchurl.nix>
Impact
<nix/fetchurl.nix> historically did not verify TLS certificates on HTTPS connections. This could lead to connection details such as full URLs or credentials leaking in case of a man-in-the-middle (MITM) attack.
You may be affected by the risk of leaking credentials if you have a netrc file for authentication, or rely on derivations with impureEnvVars set to use credentials from the environment.
In addition, the commonplace trust-on-first-use (TOFU) technique of updating dependencies by specifying an invalid hash and obtaining it from a remote store was also vulnerable to a MITM injecting arbitrary store objects. This also applied to the impure derivations experimental feature.
Note that this may also happen when using Nixpkgs fetchers to obtain new hashes when not using the fake hash method, although that mechanism is not implemented in Nix itself but rather in Nixpkgs using a fixed-output derivation.
The behavior was introduced in 5db358d to make it consistent with the Nixpkgs pkgs.fetchurl and to make <nix/fetchurl.nix> work in the derivation builder sandbox, which back then did not have access to the CA bundles by default. Nowadays, CA bundles are bind-mounted on Linux.
Patches
This issue has been fixed on Nix master and in Nix 2.24.8.
Workarounds
Implement (authenticated) fetching with pkgs.fetchurl from Nixpkgs, using impureEnvVars and curlOpts as needed.