-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* More analysis tweaks for ADO integration. * Update ADO integration API changes. Fix false positives in UrlCredentials check. * Update release notes. * Update generated regexes.
- Loading branch information
1 parent
f77c941
commit 9ae97cb
Showing
6 changed files
with
37 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ public UrlCredentials() | |
|
||
Name = nameof(UrlCredentials); | ||
|
||
Pattern = @"(ftps?|https?):\/\/(?:[^:@]+):(?<refine>[^:@?]+)@"; | ||
Pattern = @"(ftps?|https?):\/\/(?<refine>[^:@\/]+:[^:@?\/]+)@"; | ||
|
||
DetectionMetadata = DetectionMetadata.MediumConfidence; | ||
|
||
|
@@ -38,7 +38,18 @@ public override IEnumerable<string> GenerateTruePositiveExamples() | |
$"http://{Guid.NewGuid()}:{Guid.NewGuid()}@example.com/", | ||
$"https://user:[email protected]", | ||
$"ftp://{Guid.NewGuid()}:{Guid.NewGuid()}@example.com/", | ||
$"ftps://user:[email protected]" | ||
$"ftps://user:[email protected]", | ||
$"http://{Guid.NewGuid()}:{Guid.NewGuid()}@example.com/embedded:colon", | ||
$"ftp://{Guid.NewGuid()}:{Guid.NewGuid()}@example.com/embedded:colon", | ||
}; | ||
} | ||
|
||
public override IEnumerable<string> GenerateFalsePositiveExamples() | ||
{ | ||
return new[] | ||
{ | ||
$"http://example.com/embedded:colon", | ||
$"ftp://@example.com/embedded:colon", | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -251,7 +251,7 @@ public void SecretMasker_UrlCredentialsAreMasked() | |
{ | ||
using var secretMasker = InitializeTestMasker(); | ||
string input = "https://user:[email protected]"; | ||
string expected = "https://user:[email protected]"; | ||
string expected = "https://[email protected]"; | ||
|
||
string actual = secretMasker.MaskSecrets(input); | ||
Assert.AreEqual(expected, actual); | ||
|
@@ -265,7 +265,7 @@ public void IsUserInfoWithSpecialCharactersMaskedCorrectly() | |
using var secretMasker = InitializeTestMasker(); | ||
|
||
string input = @"https://user:pass4';.!&*()=,[email protected]"; | ||
string expected = "https://user:[email protected]"; | ||
string expected = "https://[email protected]"; | ||
string actual = secretMasker.MaskSecrets(input); | ||
|
||
Assert.AreEqual(expected, actual); | ||
|
@@ -277,7 +277,7 @@ public void IsUserInfoWithDigitsInNameMaskedCorrectly() | |
{ | ||
using var secretMasker = InitializeTestMasker(); | ||
string input = @"https://username123:[email protected]"; | ||
string expected = "https://username123:[email protected]"; | ||
string expected = "https://[email protected]"; | ||
string actual = secretMasker.MaskSecrets(input); | ||
|
||
Assert.AreEqual(expected, actual); | ||
|
@@ -289,7 +289,7 @@ public void IsUserInfoWithLongPasswordAndNameMaskedCorrectly() | |
{ | ||
using var secretMasker = InitializeTestMasker(); | ||
string input = @"https://username_loooooooooooooooooooooooooooooooooooooooooong:password_looooooooooooooooooooooooooooooooooooooooooooooooong@example.com"; | ||
string expected = "https://username_loooooooooooooooooooooooooooooooooooooooooong:[email protected]"; | ||
string expected = "https://[email protected]"; | ||
string actual = secretMasker.MaskSecrets(input); | ||
|
||
Assert.AreEqual(expected, actual); | ||
|
@@ -301,7 +301,7 @@ public void IsUserInfoWithEncodedCharactersInNameMaskedCorrectly() | |
{ | ||
using var secretMasker = InitializeTestMasker(); | ||
string input = @"https://username%10%A3%F6:[email protected]"; | ||
string expected = "https://username%10%A3%F6:[email protected]"; | ||
string expected = "https://[email protected]"; | ||
string actual = secretMasker.MaskSecrets(input); | ||
|
||
Assert.AreEqual(expected, actual); | ||
|
@@ -313,7 +313,7 @@ public void IsUserInfoWithEncodedAndEscapedCharactersInNameMaskedCorrectly() | |
{ | ||
using var secretMasker = InitializeTestMasker(); | ||
string input = @"https://username%AZP2510%AZP25A3%AZP25F6:[email protected]"; | ||
string expected = "https://username%AZP2510%AZP25A3%AZP25F6:[email protected]"; | ||
string expected = "https://[email protected]"; | ||
string actual = secretMasker.MaskSecrets(input); | ||
|
||
Assert.AreEqual(expected, actual); | ||
|