Skip to content

Commit

Permalink
adding 'token' keyword to regex for github_old (#2037)
Browse files Browse the repository at this point in the history
  • Loading branch information
ankushgoel27 authored Oct 30, 2023
1 parent efe7723 commit 2a66d41
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/detectors/github_old/github_old.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (Scanner) DefaultEndpoint() string { return "https://api.github.com" }
var (
// Oauth token
// https://developer.github.com/v3/#oauth2-token-sent-in-a-header
keyPat = regexp.MustCompile(`(?i)(?:github|gh|pat)[^\.].{0,40}[ =:'"]+([a-f0-9]{40})\b`)
keyPat = regexp.MustCompile(`(?i)(?:github|gh|pat|token)[^\.].{0,40}[ =:'"]+([a-f0-9]{40})\b`)

// TODO: Oauth2 client_id and client_secret
// https://developer.github.com/v3/#oauth2-keysecret
Expand All @@ -43,7 +43,7 @@ type userRes struct {
// Keywords are used for efficiently pre-filtering chunks.
// Use identifiers in the secret preferably, or the provider name.
func (s Scanner) Keywords() []string {
return []string{"github", "gh", "pat"}
return []string{"github", "gh", "pat", "token"}
}

// FromData will find and optionally verify GitHub secrets in a given set of bytes.
Expand Down

0 comments on commit 2a66d41

Please sign in to comment.