fetchurl: enable TLS verification when credentials are used (#344000)

This commit is contained in:
Martin Weinelt 2024-09-24 01:57:32 +02:00 committed by GitHub
commit ee35dc7c19
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -164,7 +164,8 @@ stdenvNoCC.mkDerivation ((
# New-style output content requirements.
inherit (hash_) outputHashAlgo outputHash;
SSL_CERT_FILE = if (hash_.outputHash == "" || hash_.outputHash == lib.fakeSha256 || hash_.outputHash == lib.fakeSha512 || hash_.outputHash == lib.fakeHash)
# Disable TLS verification only when we know the hash and no credentials are needed to access the ressource
SSL_CERT_FILE = if (hash_.outputHash == "" || hash_.outputHash == lib.fakeSha256 || hash_.outputHash == lib.fakeSha512 || hash_.outputHash == lib.fakeHash || netrcPhase != null)
then "${cacert}/etc/ssl/certs/ca-bundle.crt"
else "/no-cert-file.crt";