Skip to content

Impelement secrets detection for Az modules #412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 28, 2024
Prev Previous commit
Next Next commit
Return null for AzurePSSanitizer when AzureSession is not properly in…
…itialized
  • Loading branch information
vidai-msft committed Feb 25, 2024
commit 92d8b3830e0a5154830c51d679e268cf00a44b53
20 changes: 19 additions & 1 deletion src/Common/AzurePSCmdlet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,25 @@ public RuntimeDefinedParameterDictionary AsJobDynamicParameters
}
}

private IAzurePSSanitizer Sanitizer => AzureSession.Instance.TryGetComponent<IAzurePSSanitizer>(nameof(IAzurePSSanitizer), out var sanitizer) ? sanitizer : null;
private IAzurePSSanitizer Sanitizer
{
get
{
try
{
if (AzureSession.Instance.TryGetComponent<IAzurePSSanitizer>(nameof(IAzurePSSanitizer), out var sanitizer))
{
return sanitizer;
}
}
catch
{
// Ignore exceptions
}

return null;
}
}

private SanitizerTelemetry _sanitizerInfo;

Expand Down
2 changes: 1 addition & 1 deletion src/Common/Sanitizer/DefaultProviderResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ private bool IsOfTypeCustomObject(Type type)

private bool IsIgnoredProperty(string typeName, string propertyName)
{
bool ignored = true;
bool ignored = false;

if (Service.IgnoredProperties.ContainsKey(typeName))
{
Expand Down