From 9836b4469a575b6b1aa7c9072c28b2f4ef6ec91d Mon Sep 17 00:00:00 2001 From: Damon Tivel Date: Wed, 18 Jan 2023 04:12:32 -0800 Subject: [PATCH] Signing: enable signature verification by default on Linux in .NET 8 SDK (#5006) Resolve https://github.com/NuGet/Home/issues/11262. --- src/NuGet.Core/NuGet.Packaging/PackageArchiveReader.cs | 2 +- .../NuGet.Packaging.Test/PackageArchiveReaderTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/NuGet.Core/NuGet.Packaging/PackageArchiveReader.cs b/src/NuGet.Core/NuGet.Packaging/PackageArchiveReader.cs index 79f632400a2..fd8a484ec3f 100644 --- a/src/NuGet.Core/NuGet.Packaging/PackageArchiveReader.cs +++ b/src/NuGet.Core/NuGet.Packaging/PackageArchiveReader.cs @@ -530,7 +530,7 @@ public override bool CanVerifySignedPackages(SignedPackageVerifierSettings verif string signVerifyEnvVariable = _environmentVariableReader.GetEnvironmentVariable( EnvironmentVariableConstants.DotNetNuGetSignatureVerification); - bool canVerify = false; + bool canVerify = RuntimeEnvironmentHelper.IsLinux; if (!string.IsNullOrEmpty(signVerifyEnvVariable)) { diff --git a/test/NuGet.Core.Tests/NuGet.Packaging.Test/PackageArchiveReaderTests.cs b/test/NuGet.Core.Tests/NuGet.Packaging.Test/PackageArchiveReaderTests.cs index e22a207e6fb..e90d04ba1eb 100644 --- a/test/NuGet.Core.Tests/NuGet.Packaging.Test/PackageArchiveReaderTests.cs +++ b/test/NuGet.Core.Tests/NuGet.Packaging.Test/PackageArchiveReaderTests.cs @@ -2102,7 +2102,7 @@ public void CanVerifySignedPackages_ReturnsValueBasedOnOperatingSystemAndFramewo private static bool CanVerifySignedPackages(IEnvironmentVariableReader environmentVariableReader = null) { - return (RuntimeEnvironmentHelper.IsWindows || + return (RuntimeEnvironmentHelper.IsWindows || RuntimeEnvironmentHelper.IsLinux || IsVerificationEnabledByEnvironmentVariable(environmentVariableReader)) && #if IS_SIGNING_SUPPORTED true;