Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -303,16 +303,27 @@ private void PopulateDefaultSanitizers()
// Registering a few common sanitizers for values that we know will be universally present and cleaned up
if (EnableDefaultSanitizerAdditions)
{
GeneralRegexSanitizers.Add(new GeneralRegexSanitizer(new GeneralRegexSanitizerBody()
GeneralRegexSanitizers.Add(new(new()
{
Regex = Settings.ResourceBaseName,
Value = "Sanitized",
}));
GeneralRegexSanitizers.Add(new GeneralRegexSanitizer(new GeneralRegexSanitizerBody()
GeneralRegexSanitizers.Add(new(new()
{
Regex = Settings.SubscriptionId,
Value = EmptyGuid,
}));
// Sanitize Resource Group name from the URI. This is needed as there is another default GeneralRegexSanitizer for
// Settings.ResourceBaseName. But there are two issues we hit with that:
// 1. Resource group names often have other characters added to it, like prepending or appending for uniqueness.
// 2. In playback, Settings.ResourceBaseName and Settings.ResourceGroupName are both configured to be 'Sanitized',
// so it won't find the right string.
UriRegexSanitizers.Add(new(new()
{
Value = "Sanitized",
Regex = "/resource[gG]roups/(?<rgname>[\\w\\-.()]{1,90})(?=/|\\?|$)",
GroupForReplace = "rgname"
}));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ public AppConfigCommandTests(ITestOutputHelper output, TestProxyFixture fixture,
_appConfigService = new AppConfigService(subscriptionService, tenantService, _logger, httpClientFactory);
}

public override List<BodyRegexSanitizer> BodyRegexSanitizers => new()
{
public override List<BodyRegexSanitizer> BodyRegexSanitizers =>
[
new BodyRegexSanitizer(new BodyRegexSanitizerBody() {
Regex = "\"domains\"\\s*:\\s*\\[(?s)(?<domains>.*?)\\]",
GroupForReplace = "domains",
Value = "\"contoso.com\""
})
};
];

public override async ValueTask DisposeAsync()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "",
"TagPrefix": "Azure.Mcp.Tools.AppConfig.LiveTests",
"Tag": "Azure.Mcp.Tools.AppConfig.LiveTests_db8ee56198"
"Tag": "Azure.Mcp.Tools.AppConfig.LiveTests_d4554e504e"
}