Merged PR 693995: Conditionally compile CredScan logic on netcoreapp

The Microsoft.Automata.SRM version is only netstandard2.1 so it can't be consumed on net472. Also use stabler versions on some packages
This commit is contained in:
Marcelo Lynch 🧉 2022-12-15 20:28:40 +00:00
Родитель 0bfb9e7850
Коммит bb09e1dc54
5 изменённых файлов: 16 добавлений и 15 удалений

Просмотреть файл

@ -1543,7 +1543,7 @@ namespace IntegrationTest.BuildXL.Scheduler
}
}
#if MICROSOFT_INTERNAL
#if (MICROSOFT_INTERNAL && NETCOREAPP)
/// <summary>
/// This test to ensure that CredentialScanner detects the credentials when passed in environment variables and logs a warning in this case.
/// Most of these test cases are an assumption of what the credentialscanner might or might not detect as a credential.
@ -1572,7 +1572,7 @@ namespace IntegrationTest.BuildXL.Scheduler
}
#endif
#if MICROSOFT_INTERNAL
#if (MICROSOFT_INTERNAL && NETCOREAPP)
/// <summary>
/// /credScanEnvironmentVariablesAllowList flag allows the user to pass envVars which needs to be skipped by the CredScan library.
/// This test used to test if that functionality is working or not.

Просмотреть файл

@ -26,13 +26,14 @@ export const dll = BuildXLSdk.library({
importFrom("BuildXL.Utilities").Storage.dll,
importFrom("BuildXL.Utilities").Collections.dll,
importFrom("BuildXL.Utilities").Configuration.dll,
...addIf(BuildXLSdk.Flags.isMicrosoftInternal,
importFrom("Microsoft.Automata.SRM").withQualifier({ targetFramework: "netstandard2.1" }).pkg,
importFrom("Microsoft.ApplicationInsights").pkg,
importFrom("Microsoft.Security.RegularExpressions").pkg,
importFrom("Microsoft.Security.CredScan.KnowledgeBase").pkg,
importFrom("Microsoft.Security.CredScan.KnowledgeBase.Client").pkg,
importFrom("Microsoft.Security.CredScan.KnowledgeBase.Ruleset").pkg ),
...addIf(BuildXLSdk.Flags.isMicrosoftInternal && qualifier.targetFramework === "net6.0",
importFrom("Microsoft.Automata.SRM").withQualifier({ targetFramework: "netstandard2.1" }).pkg,
importFrom("Microsoft.ApplicationInsights").pkg,
importFrom("Microsoft.Security.RegularExpressions").pkg,
importFrom("Microsoft.Security.CredScan.KnowledgeBase").pkg,
importFrom("Microsoft.Security.CredScan.KnowledgeBase.Client").pkg,
importFrom("Microsoft.Security.CredScan.KnowledgeBase.Ruleset").pkg
),
],
internalsVisibleTo: [
"BuildXL.Scheduler",

Просмотреть файл

@ -4,7 +4,7 @@ using System.Collections.Concurrent;
using System.Linq;
using BuildXL.Pips.Graph;
using BuildXL.Utilities.Tracing;
#if MICROSOFT_INTERNAL
#if (MICROSOFT_INTERNAL && NETCOREAPP)
using Microsoft.Security.CredScan.ClientLib;
using Microsoft.Security.CredScan.KnowledgeBase.Client;
#endif
@ -32,7 +32,7 @@ namespace BuildXL.Pips.Builders
/// </summary>
public CounterCollection<CredScanCounter> Counters;
#if MICROSOFT_INTERNAL
#if (MICROSOFT_INTERNAL && NETCOREAPP)
/// <summary>
/// CredentialScannerFactory object
/// </summary>
@ -45,7 +45,7 @@ namespace BuildXL.Pips.Builders
/// <param name="enableCredScan"></param>
public CredentialScanner(bool enableCredScan)
{
#if MICROSOFT_INTERNAL
#if (MICROSOFT_INTERNAL && NETCOREAPP)
EnableCredScan = enableCredScan;
if (enableCredScan)
{
@ -60,7 +60,7 @@ namespace BuildXL.Pips.Builders
/// </summary>
public bool CredentialsDetected(string envVarKey, string envVarValue)
{
#if MICROSOFT_INTERNAL
#if (MICROSOFT_INTERNAL && NETCOREAPP)
// Converting the env variable into the below pattern.
// Ex: string input = "password: Cr3d5c@n_D3m0_P@55w0rd";
// The above example is one of the suggested patterns to represent the input string which is to be passed to the CredScan method.

Просмотреть файл

@ -2796,7 +2796,7 @@
"Type": "NuGet",
"NuGet": {
"Name": "Strings.Interop",
"Version": "1.5.0-alpha-0100-g6ee5829558"
"Version": "1.10.0"
}
}
},

Просмотреть файл

@ -88,7 +88,7 @@ export const pkgs = isMicrosoftInternal ? [
{ id: "Microsoft.Internal.Analyzers", version: "2.6.11"},
// CredScan
{ id: "Strings.Interop", version: "1.5.0-alpha-0100-g6ee5829558" },
{ id: "Strings.Interop", version: "1.10.0" },
{ id: "RE2.Managed", version: "1.10.0" },
{ id: "Microsoft.Automata.SRM", version: "2.0.0-alpha3", dependentPackageIdsToSkip: ["System.Collections.Immutable"] },
{ id: "Crc32.NET", version: "1.2.0" },