Skip to content

Commit

Permalink
add general SAS url sanitizer
Browse files Browse the repository at this point in the history
  • Loading branch information
scbedd committed Apr 26, 2024
1 parent 4fba36e commit d443c3e
Showing 1 changed file with 43 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,131 +97,128 @@ public SanitizerDictionary() {
"AZSDK1006",
"ACS Identity leverages these strings to store identity information."
),
new RegisteredSanitizer(
new GeneralRegexSanitizer(regex: "(?:[?&](sv|sig|se|srt|ss|sp)=)(?<secret>[^&\\\"\\s]*)", groupForReplace: "secret"),
"AZSDK1007",
"Common SAS URL Sanitizer. Applies to all headers, URIs, and text bodies."
),
#endregion
#region HeaderRegex
new RegisteredSanitizer(
new HeaderRegexSanitizer("api-key"),
"AZSDK2001"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("ServiceBusDlqSupplementaryAuthorization", regex: "(?:(sv|sig|se|srt|ss|sp)=)(?<secret>[^&\\\"]+)", groupForReplace: "secret"),
"AZSDK2002"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("ServiceBusSupplementaryAuthorization", regex: "(?:(sv|sig|se|srt|ss|sp)=)(?<secret>[^&\\\"]+)", groupForReplace: "secret"),
"AZSDK2003"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("x-ms-encryption-key"),
"AZSDK2004"
"AZSDK2002"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("Location", value: "https://example.com"),
"AZSDK2005"
"AZSDK2003"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("subscription-key"),
"AZSDK2006"
"AZSDK2004"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("SupplementaryAuthorization"),
"AZSDK2007"
"AZSDK2005"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("x-ms-rename-source"),
"AZSDK2008"
"AZSDK2006"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("x-ms-file-rename-source"),
"AZSDK2009"
"AZSDK2007"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("x-ms-copy-source"),
"AZSDK2010"
"AZSDK2008"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("x-ms-copy-source-authorization"),
"AZSDK2011"
"AZSDK2009"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("x-ms-file-rename-source-authorization"),
"AZSDK2012"
"AZSDK2010"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("x-ms-encryption-key-sha256"),
"AZSDK2013"
"AZSDK2011"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("aeg-sas-token"),
"AZSDK2014"
"AZSDK2012"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("aeg-sas-key"),
"AZSDK2015"
"AZSDK2013"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("aeg-channel-name"),
"AZSDK2016"
"AZSDK2014"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("Set-Cookie"),
"AZSDK2017"
"AZSDK2015"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("Cookie"),
"AZSDK2018"
"AZSDK2016"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("client-request-id"),
"AZSDK2019"
"AZSDK2017"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("MS-CV"),
"AZSDK2020"
"AZSDK2018"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("X-Azure-Ref"),
"AZSDK2021"
"AZSDK2019"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("x-ms-request-id"),
"AZSDK2022"
"AZSDK2020"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("x-ms-client-request-id"),
"AZSDK2023"
"AZSDK2021"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("x-ms-content-sha256"),
"AZSDK2024"
"AZSDK2022"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("Content-Security-Policy-Report-Only"),
"AZSDK2025"
"AZSDK2023"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("Repeatability-First-Sent"),
"AZSDK2026"
"AZSDK2024"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("Repeatability-Request-ID"),
"AZSDK2027"
"AZSDK2025"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("repeatability-request-id"),
"AZSDK2028"
"AZSDK2026"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("repeatability-first-sent"),
"AZSDK2029"
"AZSDK2027"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("P3P"),
"AZSDK2030"
"AZSDK2028"
),
new RegisteredSanitizer(
new HeaderRegexSanitizer("x-ms-ests-server"),
"AZSDK2031"
"AZSDK2029"
),
#endregion
#region BodyRegex
Expand All @@ -237,49 +234,45 @@ public SanitizerDictionary() {
new BodyRegexSanitizer(regex: "client_assertion=(?<secret>[^&\\\"]+)", groupForReplace: "secret"),
"AZSDK3002"
),
new RegisteredSanitizer(
new BodyRegexSanitizer(regex: "(?:(sv|sig|se|srt|ss|sp)=)(?<secret>[^&\\\"\\s]*)", groupForReplace: "secret"),
"AZSDK3003"
),
new RegisteredSanitizer(
new BodyRegexSanitizer(regex: "token=(?<token>[^&\\\"]+)($|&)", groupForReplace: "token"),
"AZSDK3004"
"AZSDK3003"
),
new RegisteredSanitizer(
new BodyRegexSanitizer(regex: "-----BEGIN PRIVATE KEY-----\\n(?<cert>.+\\n)*-----END PRIVATE KEY-----\\n", groupForReplace: "cert"),
"AZSDK3005"
"AZSDK3004"
),
new RegisteredSanitizer(
new BodyRegexSanitizer(regex: "(?<=<UserDelegationKey>).*?(?:<Value>)(?<group>.*)(?:</Value>)", groupForReplace: "group"),
"AZSDK3006"
"AZSDK3005"
),
new RegisteredSanitizer(
new BodyRegexSanitizer(regex: "(?<=<UserDelegationKey>).*?(?:<SignedTid>)(?<group>.*)(?:</SignedTid>)", groupForReplace: "group"),
"AZSDK3007"
"AZSDK3006"
),
new RegisteredSanitizer(
new BodyRegexSanitizer(regex: "(?<=<UserDelegationKey>).*?(?:<SignedOid>)(?<group>.*)(?:</SignedOid>)", groupForReplace: "group"),
"AZSDK3008"
"AZSDK3007"
),
new RegisteredSanitizer(
new BodyRegexSanitizer(regex: "(?:Password=)(?<pwd>.*?)(?:;)", groupForReplace: "pwd"),
"AZSDK3009"
"AZSDK3008"
),
new RegisteredSanitizer(
new BodyRegexSanitizer(regex: "(?:User ID=)(?<id>.*?)(?:;)", groupForReplace: "id"),
"AZSDK3010"
"AZSDK3009"
),
new RegisteredSanitizer(
new BodyRegexSanitizer(regex: "(?:<PrimaryKey>)(?<key>.*)(?:</PrimaryKey>)", groupForReplace: "key"),
"AZSDK3011"
"AZSDK3010"
),
new RegisteredSanitizer(
new BodyRegexSanitizer(regex: "(?:<SecondaryKey>)(?<key>.*)(?:</SecondaryKey>)", groupForReplace: "key"),
"AZSDK3012"
"AZSDK3011"
),
new RegisteredSanitizer(
new BodyRegexSanitizer(regex: "<ClientIp>(?<secret>.+)</ClientIp>", groupForReplace: "secret"),
"AZSDK3013"
"AZSDK3012"
),
#endregion
#region BodyKey
Expand Down Expand Up @@ -677,10 +670,6 @@ public SanitizerDictionary() {
new UriRegexSanitizer("REDACTED", regex: "(?<=http://|https://)(?<host>[^/?\\.]+)", groupForReplace: "host"),
"AZSDK4001"
),
new RegisteredSanitizer(
new UriRegexSanitizer(regex: "(?:(sv|sig|se|srt|ss|sp)=)(?<secret>[^&\\\"\\s]*)", groupForReplace: "secret"),
"AZSDK4002"
),
#endregion
#region RemoveHeader
new RegisteredSanitizer(
Expand Down

0 comments on commit d443c3e

Please sign in to comment.