diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/IntegrationTests/GitStoreIntegrationPushTests.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/IntegrationTests/GitStoreIntegrationPushTests.cs index 013f50856e5..c78f8569f92 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/IntegrationTests/GitStoreIntegrationPushTests.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/IntegrationTests/GitStoreIntegrationPushTests.cs @@ -721,7 +721,7 @@ public async Task SecretProtectionPreventsPush(string inputJson) // no changes should be committed var pendingChanges = store.DetectPendingChanges(parsedConfiguration); - Assert.Equal(2, pendingChanges.Count()); + Assert.Equal(3, pendingChanges.Count()); // now double check the actual scan results to ensure they are where we expect var detectedSecrets = store.SecretScanner.DiscoverSecrets(parsedConfiguration.AssetsRepoLocation, pendingChanges); diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/SecretScanner.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/SecretScanner.cs index 377eab53e14..8af2f8bdf7f 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/SecretScanner.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/SecretScanner.cs @@ -1,3 +1,4 @@ + using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -41,24 +42,27 @@ public List> DiscoverSecrets(string assetRepoRoot, IEnu Parallel.ForEach(relativePaths, options, (filePath) => { - var path = Path.Combine(assetRepoRoot, filePath); - - if (File.Exists(path)) - { - var content = File.ReadAllText(path); - var fileDetections = DetectSecrets(content); + if (!filePath.StartsWith("D")) { + var isolatedPath = filePath.Trim().TrimStart('?', 'M').Trim(); + var path = Path.Combine(assetRepoRoot, isolatedPath); - if (fileDetections != null && fileDetections.Count > 0) + if (File.Exists(path)) { - foreach (Detection detection in fileDetections) + var content = File.ReadAllText(path); + var fileDetections = DetectSecrets(content); + + if (fileDetections != null && fileDetections.Count > 0) { - detectedSecrets.Add(Tuple.Create(filePath, detection)); + foreach (Detection detection in fileDetections) + { + detectedSecrets.Add(Tuple.Create(filePath, detection)); + } } - } - Interlocked.Increment(ref seen); + Interlocked.Increment(ref seen); - Console.Write($"\r\u001b[2KScanned {seen}/{total}."); + Console.Write($"\r\u001b[2KScanned {seen}/{total}."); + } } }); diff --git a/tools/test-proxy/tests.yml b/tools/test-proxy/tests.yml index 824eace3f8f..1b3912c2796 100644 --- a/tools/test-proxy/tests.yml +++ b/tools/test-proxy/tests.yml @@ -162,12 +162,18 @@ stages: CLONE_LOCATION: "$(Agent.BuildDirectory)/net_repo" steps: - - task: UseDotNet@2 # About UseDotNet@2 task: + - task: UseDotNet@2 displayName: "Install .NET 8" retryCountOnTaskFailure: 3 inputs: version: "8.x" + - task: UseDotNet@2 + displayName: "Install .NET 7" + retryCountOnTaskFailure: 3 + inputs: + version: "7.x" + - template: /eng/pipelines/templates/steps/install-dotnet.yml - pwsh: |