Skip to content

Commit

Permalink
Add new properties in the IOutputSanitizer (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
vidai-msft authored Jul 23, 2024
1 parent c4f1529 commit ccb149a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Common/AzurePSCmdlet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,9 @@ protected void WriteSurvey()

private void SanitizeOutput(object sendToPipeline)
{
if (OutputSanitizer?.RequireSecretsDetection == true)
if (OutputSanitizer != null && OutputSanitizer.RequireSecretsDetection
&& !OutputSanitizer.IgnoredModules.Contains(MyInvocation?.MyCommand?.ModuleName)
&& !OutputSanitizer.IgnoredCmdlets.Contains(MyInvocation?.MyCommand?.Name))
{
OutputSanitizer.Sanitize(sendToPipeline, out var telemetry);
_qosEvent?.SanitizerInfo.Combine(telemetry);
Expand Down
6 changes: 6 additions & 0 deletions src/Common/Sanitizer/IOutputSanitizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using System.Collections.Generic;

namespace Microsoft.WindowsAzure.Commands.Common.Sanitizer
{
public interface IOutputSanitizer
{
bool RequireSecretsDetection { get; }

IEnumerable<string> IgnoredModules { get; }

IEnumerable<string> IgnoredCmdlets { get; }

void Sanitize(object sanitizingObject, out SanitizerTelemetry telemetryData);
}
}

0 comments on commit ccb149a

Please sign in to comment.