diff --git a/documentation/wiki/ChangeWaves.md b/documentation/wiki/ChangeWaves.md index 9d90c75075e..5a3d6067090 100644 --- a/documentation/wiki/ChangeWaves.md +++ b/documentation/wiki/ChangeWaves.md @@ -31,7 +31,7 @@ A wave of features is set to "rotate out" (i.e. become standard functionality) t - [Emit eval props if requested by any sink](https://github.com/dotnet/msbuild/pull/10243) ### 17.10 -- [AppDomain configuration is serialized without using BinFmt](https://github.com/dotnet/msbuild/pull/9320) - feature can be opted out only if [BinaryFormatter](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.serialization.formatters.binary.binaryformatter) is allowed at runtime by editing `MSBuild.runtimeconfig.json` +- [AppDomain configuration is serialized without using BinFmt](https://github.com/dotnet/msbuild/pull/9320) - feature can be opted out only if [BinaryFormatter](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.serialization.formatters.binary.binaryformatter) is allowed at runtime by editing `MSBuild.runtimeconfig.json`. **Please note that [any usage of BinaryFormatter is insecure](https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide).** - [Warning on serialization custom events by default in .NET framework](https://github.com/dotnet/msbuild/pull/9318) - [Cache SDK resolver data process-wide](https://github.com/dotnet/msbuild/pull/9335) - [Target parameters will be unquoted](https://github.com/dotnet/msbuild/pull/9452), meaning the ';' symbol in the parameter target name will always be treated as separator diff --git a/src/Framework/BinaryTranslator.cs b/src/Framework/BinaryTranslator.cs index a2a72ede9eb..41a5914dad6 100644 --- a/src/Framework/BinaryTranslator.cs +++ b/src/Framework/BinaryTranslator.cs @@ -1197,11 +1197,15 @@ public void TranslateEnum(ref T value, int numericValue) /// The value to be translated. public void TranslateDotNet(ref T value) { - if (!TranslateNullable(value)) + // All the calling paths are already guarded by ChangeWaves.Wave17_10 - so it's a no-op adding it here as well. + // But let's have it here explicitly - so it's clearer for the CodeQL reviewers. + if (!TranslateNullable(value) || !ChangeWaves.AreFeaturesEnabled(ChangeWaves.Wave17_10)) { return; } + // codeql[cs/dangerous-binary-deserialization] This code needs explicit opt-in to be used (ChangeWaves.Wave17_10). This exists as a temporary compat opt-in for old 3rd party loggers, before they are migrated based on documented guidance. + // The opt-in documentation: https://github.com/dotnet/msbuild/blob/main/documentation/wiki/ChangeWaves.md#1710 BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(_packetStream, value); } diff --git a/src/Tasks/ManifestUtil/Util.cs b/src/Tasks/ManifestUtil/Util.cs index f8bd53d1a44..a6b50bd028f 100644 --- a/src/Tasks/ManifestUtil/Util.cs +++ b/src/Tasks/ManifestUtil/Util.cs @@ -246,6 +246,7 @@ private static void GetFileInfoImpl(string path, string targetFrameWorkVersion, if (string.IsNullOrEmpty(targetFrameWorkVersion) || CompareFrameworkVersions(targetFrameWorkVersion, Constants.TargetFrameworkVersion40) <= 0) { #pragma warning disable SA1111, SA1009 // Closing parenthesis should be on line of last parameter + // codeql[cs/weak-crypto] .NET 4.0 and earlier versions cannot parse SHA-2. Newer Frameworks use SHA256. https://devdiv.visualstudio.com/DevDiv/_workitems/edit/139025 hashAlg = SHA1.Create( #if FEATURE_CRYPTOGRAPHIC_FACTORY_ALGORITHM_NAMES "System.Security.Cryptography.SHA1CryptoServiceProvider" diff --git a/src/Tasks/ManifestUtil/mansign2.cs b/src/Tasks/ManifestUtil/mansign2.cs index 1e98ca0ec72..4596c143be9 100644 --- a/src/Tasks/ManifestUtil/mansign2.cs +++ b/src/Tasks/ManifestUtil/mansign2.cs @@ -586,6 +586,7 @@ private static byte[] ComputeHashFromManifest(XmlDocument manifestDom, bool oldF else { #pragma warning disable SA1111, SA1009 // Closing parenthesis should be on line of last parameter + // codeql[cs/weak-crypto] SHA1 is retained for compatibility reasons as an option in VisualStudio signing page and consequently in the trust manager, default is SHA2. https://devdiv.visualstudio.com/DevDiv/_workitems/edit/139025 using (SHA1 sha1 = SHA1.Create( #if FEATURE_CRYPTOGRAPHIC_FACTORY_ALGORITHM_NAMES "System.Security.Cryptography.SHA1CryptoServiceProvider" @@ -648,6 +649,7 @@ private static byte[] ComputeHashFromManifest(XmlDocument manifestDom, bool oldF else { #pragma warning disable SA1111, SA1009 // Closing parenthesis should be on line of last parameter + // codeql[cs/weak-crypto] SHA1 is retained for compatibility reasons as an option in VisualStudio signing page and consequently in the trust manager, default is SHA2. https://devdiv.visualstudio.com/DevDiv/_workitems/edit/139025 using (SHA1 sha1 = SHA1.Create( #if FEATURE_CRYPTOGRAPHIC_FACTORY_ALGORITHM_NAMES "System.Security.Cryptography.SHA1CryptoServiceProvider"