Skip to content

Commit

Permalink
Merge branch 'add-common-sanitizers' into no-output/add-common-saniti…
Browse files Browse the repository at this point in the history
…zers
  • Loading branch information
scbedd committed May 1, 2024
2 parents 26fd862 + 6b05161 commit 8894df9
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public SanitizerDictionary() {
* */

private const string EMPTYGUID = "00000000-0000-0000-0000-000000000000";
private const string BASE64ZERO = "MA==";

public List<RegisteredSanitizer> DefaultSanitizerList = new List<RegisteredSanitizer>
{
Expand Down Expand Up @@ -98,7 +99,7 @@ public SanitizerDictionary() {
"ACS Identity leverages these strings to store identity information."
),
new RegisteredSanitizer(
new GeneralRegexSanitizer(regex: "(?:[?&](sv|sig|se|srt|ss|sp)=)(?<secret>[^&\\\"\\s]*)", groupForReplace: "secret"),
new GeneralRegexSanitizer(regex: "(?:[?&](sig)=)(?<secret>[^&\\\"\\s]*)", groupForReplace: "secret"),
"AZSDK1007",
"Common SAS URL Sanitizer. Applies to all headers, URIs, and text bodies."
),
Expand Down Expand Up @@ -243,15 +244,15 @@ public SanitizerDictionary() {
"AZSDK3004"
),
new RegisteredSanitizer(
new BodyRegexSanitizer(regex: "(?<=<UserDelegationKey>).*?(?:<Value>)(?<group>.*)(?:</Value>)", groupForReplace: "group"),
new BodyRegexSanitizer(regex: "(?<=<UserDelegationKey>).*?(?:<Value>)(?<group>.*)(?:</Value>)", groupForReplace: "group", value: BASE64ZERO),
"AZSDK3005"
),
new RegisteredSanitizer(
new BodyRegexSanitizer(regex: "(?<=<UserDelegationKey>).*?(?:<SignedTid>)(?<group>.*)(?:</SignedTid>)", groupForReplace: "group"),
new BodyRegexSanitizer(regex: "(?<=<UserDelegationKey>).*?(?:<SignedTid>)(?<group>.*)(?:</SignedTid>)", groupForReplace: "group", value: EMPTYGUID),
"AZSDK3006"
),
new RegisteredSanitizer(
new BodyRegexSanitizer(regex: "(?<=<UserDelegationKey>).*?(?:<SignedOid>)(?<group>.*)(?:</SignedOid>)", groupForReplace: "group"),
new BodyRegexSanitizer(regex: "(?<=<UserDelegationKey>).*?(?:<SignedOid>)(?<group>.*)(?:</SignedOid>)", groupForReplace: "group", value: EMPTYGUID),
"AZSDK3007"
),
new RegisteredSanitizer(
Expand Down Expand Up @@ -660,6 +661,10 @@ public SanitizerDictionary() {
new BodyKeySanitizer("$..resourceLocation"),
"AZSDK3496"
),
new RegisteredSanitizer(
new BodyKeySanitizer("$..keyVaultClientId", value: EMPTYGUID),
"AZSDK3497"
),
#endregion
#region UriRegex
new RegisteredSanitizer(
Expand Down

0 comments on commit 8894df9

Please sign in to comment.