Skip to content

Commit f31ad18

Browse files
committed
Update pkg/detectors/bitbucketapppassword/bitbucketapppassword.go
Co-authored-by: Amaan Ullah <[email protected]>
1 parent ee5b6a3 commit f31ad18

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pkg/detectors/bitbucketapppassword/bitbucketapppassword.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ var (
2626
// https://support.atlassian.com/bitbucket-cloud/docs/using-app-passwords/, as well as for other general cases.
2727

2828
// Covers 'username:appPassword' pattern
29-
usernamePat1 = regexp.MustCompile(`\b([A-Za-z0-9-_]{1,30}):ATBB[A-Za-z0-9_=.-]+[A-Z0-9]{8}\b`)
29+
credentialPairPattern = regexp.MustCompile(`\b([A-Za-z0-9-_]{1,30}):ATBB[A-Za-z0-9_=.-]+[A-Z0-9]{8}\b`)
3030
// Covers assignment of username to variable
31-
usernamePat2 = regexp.MustCompile(`(?im)(?:user|usr)\S{0,40}?[:=\s]{1,3}[ '"=]?([a-zA-Z0-9-_]{1,30})\b`)
31+
usernameAssignmentPattern = regexp.MustCompile(`(?im)(?:user|usr)\S{0,40}?[:=\s]{1,3}[ '"=]?([a-zA-Z0-9-_]{1,30})\b`)
3232
// Covers 'https://[email protected]' pattern
33-
usernamePat3 = regexp.MustCompile(`https://([a-zA-Z0-9-_]{1,30})@bitbucket.org`)
33+
usernameUrlPattern = regexp.MustCompile(`https://([a-zA-Z0-9-_]{1,30})@bitbucket.org`)
3434
// Covers '("username", "password")' pattern, used for HTTP Basic Auth
35-
usernamePat4 = regexp.MustCompile(`"([a-zA-Z0-9-_]{1,30})",(?: )?"ATBB[A-Za-z0-9_=.-]+[A-Z0-9]{8}"`)
35+
httpBasicAuthPattern = regexp.MustCompile(`"([a-zA-Z0-9-_]{1,30})",(?: )?"ATBB[A-Za-z0-9_=.-]+[A-Z0-9]{8}"`)
3636

3737
usernamePatterns = []*regexp.Regexp{usernamePat1, usernamePat2, usernamePat3, usernamePat4}
3838

@@ -69,7 +69,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
6969
}
7070

7171
if verify {
72-
req, err := http.NewRequestWithContext(ctx, "GET", "https://api.bitbucket.org/2.0/user", nil)
72+
req, err := http.NewRequestWithContext(ctx, http.MethodGet, "https://api.bitbucket.org/2.0/user", nil)
7373
if err != nil {
7474
continue
7575
}

0 commit comments

Comments
 (0)