diff --git a/pkg/crawler/scan.go b/pkg/crawler/scan.go index 657907f..9812483 100644 --- a/pkg/crawler/scan.go +++ b/pkg/crawler/scan.go @@ -46,25 +46,22 @@ func SecretsMatch(url, body string, secretsFile *[]string) []scanner.SecretMatch if len(*secretsFile) == 0 { for _, secret := range scanner.GetSecretRegexes() { - if matched, err := regexp.Match(secret.Regex, []byte(body)); err == nil && matched { - re := regexp.MustCompile(secret.Regex) - matches := re.FindAllStringSubmatch(body, -1) + matches := secret.Regex.FindAllStringSubmatch(body, -1) - // Avoiding false positives - var isFalsePositive = false + // Avoiding false positives + var isFalsePositive = false - for _, match := range matches { - for _, falsePositive := range secret.FalsePositives { - if strings.Contains(strings.ToLower(match[0]), falsePositive) { - isFalsePositive = true - break - } + for _, match := range matches { + for _, falsePositive := range secret.FalsePositives { + if strings.Contains(strings.ToLower(match[0]), falsePositive) { + isFalsePositive = true + break } + } - if !isFalsePositive { - secretFound := scanner.SecretMatched{Secret: secret, URL: url, Match: match[0]} - secrets = append(secrets, secretFound) - } + if !isFalsePositive { + secretFound := scanner.SecretMatched{Secret: secret, URL: url, Match: match[0]} + secrets = append(secrets, secretFound) } } } @@ -75,7 +72,7 @@ func SecretsMatch(url, body string, secretsFile *[]string) []scanner.SecretMatch matches := re.FindAllStringSubmatch(body, -1) for _, match := range matches { - secretScanned := scanner.Secret{Name: "CustomFromFile", Description: "", Regex: secret, Poc: ""} + secretScanned := scanner.Secret{Name: "CustomFromFile", Description: "", Regex: *regexp.MustCompile(secret), Poc: ""} secretFound := scanner.SecretMatched{Secret: secretScanned, URL: url, Match: match[0]} secrets = append(secrets, secretFound) } @@ -153,17 +150,13 @@ func ErrorsMatch(url, body string) []scanner.ErrorMatched { errors := []scanner.ErrorMatched{} for _, errorItem := range scanner.GetErrorRegexes() { - for _, errorRegex := range errorItem.Regex { - if matched, err := regexp.Match(errorRegex, []byte(body)); err == nil && matched { - re := regexp.MustCompile(errorRegex) - matches := re.FindAllStringSubmatch(body, -1) + matches := errorItem.Regex.FindAllStringSubmatch(body, -1) - for _, match := range matches { - errorFound := scanner.ErrorMatched{Error: errorItem, URL: url, Match: match[0]} - errors = append(errors, errorFound) - } - } + for _, match := range matches { + errorFound := scanner.ErrorMatched{Error: errorItem, URL: url, Match: match[0]} + errors = append(errors, errorFound) } + } return scanner.RemoveDuplicateErrors(errors) @@ -180,14 +173,11 @@ func InfoMatch(url, body string) []scanner.InfoMatched { infos := []scanner.InfoMatched{} for _, infoItem := range scanner.GetInfoRegexes() { - if matched, err := regexp.Match(infoItem.Regex, []byte(body)); err == nil && matched { - re := regexp.MustCompile(infoItem.Regex) - matches := re.FindAllStringSubmatch(body, -1) + matches := infoItem.Regex.FindAllStringSubmatch(body, -1) - for _, match := range matches { - infoFound := scanner.InfoMatched{Info: infoItem, URL: url, Match: match[0]} - infos = append(infos, infoFound) - } + for _, match := range matches { + infoFound := scanner.InfoMatched{Info: infoItem, URL: url, Match: match[0]} + infos = append(infos, infoFound) } } diff --git a/pkg/output/jsonl_test.go b/pkg/output/jsonl_test.go index deee023..cab0675 100644 --- a/pkg/output/jsonl_test.go +++ b/pkg/output/jsonl_test.go @@ -30,6 +30,7 @@ import ( "net/http" "net/url" "reflect" + "regexp" "testing" "github.com/edoardottt/cariddi/pkg/output" @@ -47,7 +48,7 @@ func TestJSONOutput(t *testing.T) { Secret: scanner.Secret{ Name: "mysecret", Description: "My Secret", - Regex: "random.*regex", + Regex: *regexp.MustCompile("random.*regex"), FalsePositives: []string{}, Poc: "POC", }, @@ -69,7 +70,7 @@ func TestJSONOutput(t *testing.T) { { Error: scanner.Error{ ErrorName: "MySQL error", - Regex: []string{"MySQL.*error"}, + Regex: *regexp.MustCompile("MySQL.*error"), }, URL: "http://test.com?id=5", Match: "it is a MySQL error happening", @@ -79,7 +80,7 @@ func TestJSONOutput(t *testing.T) { { Info: scanner.Info{ Name: "info1", - Regex: `my.*great`, + Regex: *regexp.MustCompile(`my.*great`), }, URL: "http://test.com?id=5", Match: "its my pleasure to inform you on this great day", diff --git a/pkg/scanner/error.go b/pkg/scanner/error.go index b0dc5ce..4597711 100644 --- a/pkg/scanner/error.go +++ b/pkg/scanner/error.go @@ -23,12 +23,14 @@ along with this program. If not, see http://www.gnu.org/licenses/. package scanner +import "regexp" + // Error struct. // ErrorName = the name that identifies the error. // Regex = The regular expression to be matched. type Error struct { ErrorName string - Regex []string + Regex regexp.Regexp } // ErrorMatched struct. @@ -46,119 +48,109 @@ func GetErrorRegexes() []Error { var regexes = []Error{ { "PHP error", - []string{ - `(?i)php (warning|error)`, - `(?i)include_path`, - `(?i)undefined (variable|index)`, - `(?i)expect(s*) parameter [A-Za-z0-9-_]{1,30}`, - `(?i)call to undefined method`, - `(?i)failed to open stream`, - `(?i)cannot modify header information`, - `(?i)(syntax|parse|fatal) error`, - `(?i)safe mode restriction in effect`, - `(?i)uncaught exception`}, + *regexp.MustCompile(`(?i)(php (warning|error)` + + `|include_path` + + `|undefined (variable|index)` + + `|expect(s*) parameter [A-Za-z0-9-_]{1,30}` + + `|call to undefined method` + + `|failed to open stream` + + `|cannot modify header information` + + `|(syntax|parse|fatal) error` + + `|safe mode restriction in effect` + + `|uncaught exception)`), }, { "ASP.Net error", - []string{ - `(?i)\"Message\"\:\"Invalid web service call`, - `(?i)\-\-\- End of inner exception stack trace \-\-\-`, - `(?i)Syntax error in string in query expression`}, + *regexp.MustCompile(`(?i)(\"Message\"\:\"Invalid web service call` + + `|\-\-\- End of inner exception stack trace \-\-\-` + + `|Syntax error in string in query expression)`), }, { "Python error", - []string{ - `(?i)Traceback \(most recent call last\)\:`, - `(?i)\(generated by waitress\)`, - `(?i)Syntax error in string in query expression`}, + *regexp.MustCompile(`(?i)(Traceback \(most recent call last\)\:` + + `|\(generated by waitress\)` + + `|Syntax error in string in query expression)`), }, { "General error", - []string{ - `(?i)(fatal|critical|severe|high|medium|low) error`}, + *regexp.MustCompile(`(?i)(fatal|critical|severe|high|medium|low) error`), }, { "Debug information", - []string{ - `(?i)Debug trace`, - `(?i)stack trace\:`}, + *regexp.MustCompile(`(?i)(Debug trace|stack trace\:)`), }, { "MySQL error", - []string{ - `(?i)valid MySQL result`, - `(?i)check the manual that (fits|corresponds to) your MySQL server version`, - `(?i)MySQLSyntaxErrorException`, - `(?i)MySqlException`, - `(?i)MySql error`, - `(?i)Unknown column `, - `(?i)SQL syntax.*?MySQL`, - `(?i)Warning.*?mysqli?`, - `(?i)com\.mysql\.jdbc`, - `(?i)Zend_Db_(Adapter|Statement)_Mysqli_Exception`, - `(?i)Syntax error or access violation`}, + *regexp.MustCompile(`(?i)(valid MySQL result` + + `|check the manual that (fits|corresponds to) your MySQL server version` + + `|MySQLSyntaxErrorException` + + `|MySqlException` + + `|MySql error` + + `|Unknown column ` + + `|SQL syntax.*?MySQL` + + `|Warning.*?mysqli?` + + `|com\.mysql\.jdbc` + + `|Zend_Db_(Adapter|Statement)_Mysqli_Exception` + + `|Syntax error or access violation)`), }, { "MariaDB error", - []string{ - `(?i)check the manual that (fits|corresponds to) your MariaDB server version`, - `(?i)MariaDB error`}, + *regexp.MustCompile(`(?i)(check the manual that (fits|corresponds to) your MariaDB server version` + + `|MariaDB error)`), }, { "PostgreSQL error", - []string{ - `(?i)valid PostgreSQL result`, - `(?i)PG::SyntaxError:`, - `(?i)PSQLException`, - `(?i)PostgreSQL query failed`, - `(?i)ERROR: parser: parse error at or near`, - `(?i)PostgreSQL error`, - `(?i)PostgreSQL.*?ERROR`, - `(?i)Warning.*?\\Wpg_`, - `(?i)Npgsql\.`, - `(?i)org\.postgresql\.util\.PSQLException`, - `(?i)ERROR:\s\ssyntax error at or near`, - `(?i)org\.postgresql\.jdbc`}, + *regexp.MustCompile(`(?i)(valid PostgreSQL result` + + `|PG::SyntaxError:` + + `|PSQLException` + + `|PostgreSQL query failed` + + `|ERROR: parser: parse error at or near` + + `|PostgreSQL error` + + `|PostgreSQL.*?ERROR` + + `|Warning.*?\\Wpg_` + + `|Npgsql\.` + + `|org\.postgresql\.util\.PSQLException` + + `|ERROR:\s\ssyntax error at or near` + + `|org\.postgresql\.jdbc)`), }, { "MSSQL error", - []string{ - `(?i)Microsoft SQL error`, - `(?i)Microsoft SQL Native Client error`, - `(?i)ODBC SQL Server Driver`, - `(?i)Unclosed quotation mark after the character string`, - `(?i)SQLServer JDBC Driver`, - `(?i)Driver.*? SQL[\-\_\ ]*Server`, - `(?i)OLE DB.*? SQL Server`, - `(?i)\bSQL Server[^<"]+Driver`, - `(?i)Warning.*?\W(mssql|sqlsrv)_`, - `(?i)\bSQL Server[^<"]+[0-9a-fA-F]{8}`, - `(?i)System\.Data\.SqlClient\.SqlException`, - `(?is)Exception.*?\bRoadhouse\.Cms\.`, - `(?i)\[SQL Server\]`, - `(?i)ODBC Driver \d+ for SQL Server`, - `(?i)com\.jnetdirect\.jsql`, - `(?i)macromedia\.jdbc\.sqlserver`, - `(?i)Zend_Db_(Adapter|Statement)_Sqlsrv_Exception`, - `(?i)com\.microsoft\.sqlserver\.jdbc`, - `(?i)SQL(Srv|Server)Exception`, - `(?i)Cannot initialize the data source object of OLE DB provider`}, + *regexp.MustCompile(`(?i)(Microsoft SQL error` + + `|Microsoft SQL Native Client error` + + `|ODBC SQL Server Driver` + + `|Unclosed quotation mark after the character string` + + `|SQLServer JDBC Driver` + + `|Driver.*? SQL[\-\_\ ]*Server` + + `|OLE DB.*? SQL Server` + + `|\bSQL Server[^<"]+Driver|Warning.*?\W(mssql|sqlsrv)_` + + `|\bSQL Server[^<"]+[0-9a-fA-F]{8}` + + `|System\.Data\.SqlClient\.SqlException` + + `|Exception.*?\bRoadhouse\.Cms\.` + + `|\[SQL Server\]` + + `|ODBC Driver \d+ for SQL Server` + + `|com\.jnetdirect\.jsql` + + `|macromedia\.jdbc\.sqlserver` + + `|Zend_Db_(Adapter|Statement)_Sqlsrv_Exception` + + `|com\.microsoft\.sqlserver\.jdbc` + + `|SQL(Srv|Server)Exception` + + `|Cannot initialize the data source object of OLE DB provider)`), }, { "OracleDB error", - []string{ - `(?i)(\bORA-\d{5}|Oracle error|Oracle.*Driver|Warning.*\Woci_.*|Warning.*\Wora_.*)`}, + *regexp.MustCompile(`(?i)(\bORA-\d{5}|Oracle error|Oracle.*Driver|Warning.*\Woci_.*|Warning.*\Wora_.*)`), }, { "IBMDB2 error", - []string{ - `(?i)(CLI Driver.*DB2|DB2 SQL error|\bdb2_\w+\(|SQLSTATE.+SQLCODE)`}, + *regexp.MustCompile(`(?i)(CLI Driver.*DB2|DB2 SQL error|\bdb2_\w+\(|SQLSTATE.+SQLCODE)`), }, { "SQLite error", - []string{ - `(?i)(SQLite\/JDBCDriver|SQLite.Exception|System.Data.SQLite.SQLiteException` + - `|Warning.*sqlite_.*|Warning.*SQLite3::|\[SQLITE_ERROR\])`}, + *regexp.MustCompile(`(?i)(SQLite\/JDBCDriver` + + `|SQLite.Exception` + + `|System.Data.SQLite.SQLiteException` + + `|Warning.*sqlite_.*` + + `|Warning.*SQLite3::` + + `|\[SQLITE_ERROR\])`), }, } diff --git a/pkg/scanner/info.go b/pkg/scanner/info.go index 17ff2e3..584ff95 100644 --- a/pkg/scanner/info.go +++ b/pkg/scanner/info.go @@ -23,12 +23,14 @@ along with this program. If not, see http://www.gnu.org/licenses/. package scanner +import "regexp" + // Info struct. // Name = the name that identifies the information. // Regex = The regular expression to be matched. type Info struct { Name string - Regex string + Regex regexp.Regexp } // InfoMatched struct. @@ -46,20 +48,20 @@ func GetInfoRegexes() []Info { var regexes = []Info{ { "Email address", - `(?i)([a-zA-Z0-9_.+-]+@[a-zA-Z0-9]+[a-zA-Z0-9-]*\.[a-zA-Z0-9-.]*[a-zA-Z0-9]{2,})`, + *regexp.MustCompile(`(?i)([a-zA-Z0-9_.+-]+@[a-zA-Z0-9]+[a-zA-Z0-9-]*\.[a-zA-Z0-9-.]*[a-zA-Z0-9]{2,})`), }, { "HTML comment", - `(?i)(\)`, + *regexp.MustCompile(`(?i)(\)`), }, { "Internal IP address", - `((172\.\d{1,3}\.\d{1,3}\.\d{1,3})|(192\.168\.\d{1,3}\.\d{1,3})|` + - `(10\.\d{1,3}\.\d{1,3}\.\d{1,3})|([fF][eE][89aAbBcCdDeEfF]::))`, + *regexp.MustCompile(`((172\.\d{1,3}\.\d{1,3}\.\d{1,3})|(192\.168\.\d{1,3}\.\d{1,3})|` + + `(10\.\d{1,3}\.\d{1,3}\.\d{1,3})|([fF][eE][89aAbBcCdDeEfF]::))`), }, { "IPv4 address", - `(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}`, + *regexp.MustCompile(`(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}`), }, /* TOO MANY FALSE POSITIVES diff --git a/pkg/scanner/secrets.go b/pkg/scanner/secrets.go index 996ff21..249587f 100644 --- a/pkg/scanner/secrets.go +++ b/pkg/scanner/secrets.go @@ -26,6 +26,8 @@ along with this program. If not, see http://www.gnu.org/licenses/. package scanner +import "regexp" + // Secret struct. // Name = the name that identifies the secret. // Description. @@ -35,7 +37,7 @@ package scanner type Secret struct { Name string Description string - Regex string + Regex regexp.Regexp FalsePositives []string Poc string } @@ -57,604 +59,604 @@ func GetSecretRegexes() []Secret { { "Adafruit API Key", "Adafruit API Key", - `(?i)(?:adafruit)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + - `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}([a-z0-9_-]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + *regexp.MustCompile(`(?i)(?:adafruit)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}([a-z0-9_-]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "Adobe Client ID", "Adobe Client ID", - `(?i)(?:adobe)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:{1,3}` + - `=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}([a-f0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + *regexp.MustCompile(`(?i)(?:adobe)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:{1,3}` + + `=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}([a-f0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "Adobe Client Secret", "Adobe Client Secret", - `(?i)\b((p8e-)(?i)[a-z0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + *regexp.MustCompile(`(?i)\b((p8e-)(?i)[a-z0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "Age Secret Key", "Age Secret Key", - `(?i)AGE-SECRET-KEY-1[QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L]{58}`, + *regexp.MustCompile(`(?i)AGE-SECRET-KEY-1[QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L]{58}`), []string{}, "?", }, { "Airtable API Key", "Airtable API Key", - `(?i)(?:airtable)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + *regexp.MustCompile(`(?i)(?:airtable)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `([a-z0-9]{17})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `([a-z0-9]{17})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "Algolia API Key", "Algolia API Key", - `(?i)(?:algolia)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + *regexp.MustCompile(`(?i)(?:algolia)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `([a-z0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `([a-z0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "Alibaba Access Key ID", "Alibaba Access Key ID", - `(?i)\b((LTAI)(?i)[a-z0-9]{20})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + *regexp.MustCompile(`(?i)\b((LTAI)(?i)[a-z0-9]{20})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "Alibaba Secret Key", "Alibaba Secret Key", - `(?i)(?:alibaba)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + *regexp.MustCompile(`(?i)(?:alibaba)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `([a-z0-9]{30})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `([a-z0-9]{30})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "Asana Client ID", "Asana Client ID", - `(?i)(?:asana)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + *regexp.MustCompile(`(?i)(?:asana)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `([0-9]{16})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `([0-9]{16})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "Asana Client Secret", "Asana Client Secret", - `(?i)(?:asana)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + *regexp.MustCompile(`(?i)(?:asana)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `([a-z0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `([a-z0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "Atlassian API Token", "Atlassian API Token", - `(?i)(?:atlassian|confluence|jira)(?:[0-9a-z\-_\t .]{0,20})` + + *regexp.MustCompile(`(?i)(?:atlassian|confluence|jira)(?:[0-9a-z\-_\t .]{0,20})` + `(?:[\s|']|[\s|"]){0,3}(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `([a-z0-9]{24})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `([a-z0-9]{24})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "AWS Access Key", "AWS Access Key", - "(A3T[A-Z0-9]|AKIA|ACCA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA|ASCA|APKA)[A-Z0-9]{16}", + *regexp.MustCompile(`(A3T[A-Z0-9]|AKIA|ACCA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA|ASCA|APKA)[A-Z0-9]{16}`), []string{}, "?", }, { "AWS Secret Key", "AWS Secret Key", - `(?i)aws(.{0,20})?(?-i)['\"][0-9a-zA-Z\/+]{40}['\"]`, + *regexp.MustCompile(`(?i)aws(.{0,20})?(?-i)['\"][0-9a-zA-Z\/+]{40}['\"]`), []string{}, "?", }, { "AWS MWS Key", "AWS MWS Key", - `amzn\.mws\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`, + *regexp.MustCompile(`amzn\.mws\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`), []string{}, "?", }, { "Amazon SNS topic", "Amazon SNS topic", - `arn:aws:sns:[a-z0-9\-]+:[0-9]+:[A-Za-z0-9\-_]+`, + *regexp.MustCompile(`arn:aws:sns:[a-z0-9\-]+:[0-9]+:[A-Za-z0-9\-_]+`), []string{}, "?", }, { "Beamer API Token", "Beamer API Token", - `(?i)(?:beamer)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + *regexp.MustCompile(`(?i)(?:beamer)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `(b_[a-z0-9=_\-]{44})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `(b_[a-z0-9=_\-]{44})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "BitBucket Client ID", "BitBucket Client ID", - `(?i)(?:bitbucket)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + *regexp.MustCompile(`(?i)(?:bitbucket)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `([a-z0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `([a-z0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "BitBucket Client Secret", "BitBucket Client Secret", - `(?i)(?:bitbucket)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + *regexp.MustCompile(`(?i)(?:bitbucket)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `([a-z0-9=_\-]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `([a-z0-9=_\-]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "Cloudflare API Key", "Cloudflare API Key", - `(?i)(?:cloudflare)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + *regexp.MustCompile(`(?i)(?:cloudflare)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `([a-z0-9_-]{40})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `([a-z0-9_-]{40})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "Cloudflare Global API Key", "Cloudflare Global API Key", - `(?i)(?:cloudflare)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + *regexp.MustCompile(`(?i)(?:cloudflare)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `([a-f0-9]{37})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `([a-f0-9]{37})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "Cloudflare Origin CA Key", "Cloudflare Origin CA Key", - `\b(v1\.0-[a-f0-9]{24}-[a-f0-9]{146})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + *regexp.MustCompile(`\b(v1\.0-[a-f0-9]{24}-[a-f0-9]{146})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "CodeCov Access Token", "CodeCov Access Token", - `(?i)(?:codecov)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + *regexp.MustCompile(`(?i)(?:codecov)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `([a-z0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `([a-z0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "CoinBase Access Token", "CoinBase Access Token", - `(?i)(?:coinbase)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + *regexp.MustCompile(`(?i)(?:coinbase)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `([a-z0-9_-]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `([a-z0-9_-]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "Confluent Access Token", "Confluent Access Token", - `(?i)(?:confluent)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + *regexp.MustCompile(`(?i)(?:confluent)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `([a-z0-9]{16})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `([a-z0-9]{16})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "Confluent Secret Key", "Confluent Secret Key", - `(?i)(?:confluent)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + *regexp.MustCompile(`(?i)(?:confluent)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `([a-z0-9]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `([a-z0-9]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "Databricks API Token", "Databricks API Token", - `(?i)\b(dapi[a-h0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + *regexp.MustCompile(`(?i)\b(dapi[a-h0-9]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "DataDog Access Token", "DataDog Access Token", - `(?i)(?:datadog)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + *regexp.MustCompile(`(?i)(?:datadog)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `([a-z0-9]{40})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `([a-z0-9]{40})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "DigitalOcean Access Token", "DigitalOcean Access Token", - `(?i)\b(doo_v1_[a-f0-9]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + *regexp.MustCompile(`(?i)\b(doo_v1_[a-f0-9]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "DigitalOcean Personal Access Token", "DigitalOcean Personal Access Token", - `(?i)\b(dop_v1_[a-f0-9]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + *regexp.MustCompile(`(?i)\b(dop_v1_[a-f0-9]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "DigitalOcean Refresh Token", "DigitalOcean Refresh Token", - `(?i)\b(dor_v1_[a-f0-9]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + *regexp.MustCompile(`(?i)\b(dor_v1_[a-f0-9]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "Discord API Token", "Discord API Token", - `(?i)(?:discord)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + *regexp.MustCompile(`(?i)(?:discord)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `([a-f0-9]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `([a-f0-9]{64})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "Discord Client ID", "Discord Client ID", - `(?i)(?:discord)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + *regexp.MustCompile(`(?i)(?:discord)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `([0-9]{18})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `([0-9]{18})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "Discord Client Secret", "Discord Client Secret", - `(?i)(?:discord)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + *regexp.MustCompile(`(?i)(?:discord)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `([a-z0-9=_\-]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `([a-z0-9=_\-]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "DropBox API Token", "DropBox API Token", - `(?i)(?:dropbox)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + *regexp.MustCompile(`(?i)(?:dropbox)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `([a-z0-9]{15})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `([a-z0-9]{15})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", }, { "Facebook Access Token", "Facebook Access Token", - `EAACEdEose0cBA[0-9A-Za-z]+`, + *regexp.MustCompile(`EAACEdEose0cBA[0-9A-Za-z]+`), []string{}, "?", }, { "Facebook Secret Key", "Facebook Secret Key", - `(?i)(facebook|fb)(.{0,20})?(?-i)['\"][0-9a-f]{32}['\"]`, + *regexp.MustCompile(`(?i)(facebook|fb)(.{0,20})?(?-i)['\"][0-9a-f]{32}['\"]`), []string{"facebook.com", "facebook.svg"}, "?", }, { "Facebook Client ID", "Facebook Client ID", - `(?i)(facebook|fb)(.{0,20})?['\"][0-9]{13,17}['\"]`, + *regexp.MustCompile(`(?i)(facebook|fb)(.{0,20})?['\"][0-9]{13,17}['\"]`), []string{"facebook.com", "facebook.svg"}, "?", }, { "Fastly API Token", "Fastly API Token", - `(?i)(?:fastly)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + *regexp.MustCompile(`(?i)(?:fastly)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `([a-z0-9=_\-]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `([a-z0-9=_\-]{32})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{"facebook.com", "facebook.svg"}, "?", }, { "Cloudinary Basic Auth", "Cloudinary Basic Auth", - `cloudinary://[0-9]{15}:[0-9A-Za-z\-_]+@[0-9A-Za-z\-_]+`, + *regexp.MustCompile(`cloudinary://[0-9]{15}:[0-9A-Za-z\-_]+@[0-9A-Za-z\-_]+`), []string{}, "?", }, { "Firebase Database", "Firebase Database", - `([a-z0-9.-]+\.firebaseio\.com|[a-z0-9.-]+\.firebaseapp\.com)`, + *regexp.MustCompile(`([a-z0-9.-]+\.firebaseio\.com|[a-z0-9.-]+\.firebaseapp\.com)`), []string{}, "?", }, { "Twitter Secret Key", "Twitter Secret Key", - `(?i)twitter(.{0,20})?[0-9a-z]{35,44}`, + *regexp.MustCompile(`(?i)twitter(.{0,20})?[0-9a-z]{35,44}`), []string{"twitter.com"}, "?", }, { "Twitter Client ID", "Twitter Client ID", - `(?i)twitter(.{0,20})?[0-9a-z]{18,25}`, + *regexp.MustCompile(`(?i)twitter(.{0,20})?[0-9a-z]{18,25}`), []string{"twitter.com"}, "?", }, { "Github Personal Access Token", "Github Personal Access Token", - `ghp_.{36}`, + *regexp.MustCompile(`ghp_.{36}`), []string{}, "?", }, { "Github OAuth Access Token", "Github OAuth Access Token", - `gho_.{36}`, + *regexp.MustCompile(`gho_.{36}`), []string{}, "?", }, { "Github App Token", "Github App Token", - `(ghu|ghs)_.{36}`, + *regexp.MustCompile(`(ghu|ghs)_.{36}`), []string{}, "?", }, { "Github Refresh Token", "Github Refresh Token", - `ghr_.{76}`, + *regexp.MustCompile(`ghr_.{76}`), []string{}, "?", }, { "LinkedIn Client ID", "LinkedIn Client ID", - `(?i)linkedin(.{0,20})?(?-i)[0-9a-z]{12}`, + *regexp.MustCompile(`(?i)linkedin(.{0,20})?(?-i)[0-9a-z]{12}`), []string{"linkedin.com", "linkedin.svg"}, "?", }, { "LinkedIn Secret Key", "LinkedIn Secret Key", - `(?i)linkedin(.{0,20})?[0-9a-z]{16}`, + *regexp.MustCompile(`(?i)linkedin(.{0,20})?[0-9a-z]{16}`), []string{"linkedin.com", "linkedin.svg"}, "?", }, { "Slack", "Slack", - `xox[baprs]-([0-9a-zA-Z]{10,48})?`, + *regexp.MustCompile(`xox[baprs]-([0-9a-zA-Z]{10,48})?`), []string{}, "?", }, { "Asymmetric Private Key", "Asymmetric Private Key", - `-----BEGIN ((EC|PGP|DSA|RSA|OPENSSH) )?PRIVATE KEY( BLOCK)?-----`, + *regexp.MustCompile(`-----BEGIN ((EC|PGP|DSA|RSA|OPENSSH) )?PRIVATE KEY( BLOCK)?-----`), []string{}, "?", }, { "Google API key", "Google API key", - `AIza[0-9A-Za-z\-_]{35}`, + *regexp.MustCompile(`AIza[0-9A-Za-z\-_]{35}`), []string{}, "?", }, { "Google (GCP) Service Account", "Google (GCP) Service Account", - `"type": "service_account"`, + *regexp.MustCompile(`"type": "service_account"`), []string{}, "?", }, { "Heroku API key", "Heroku API key", - `(?i)heroku(.{0,20})?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`, + *regexp.MustCompile(`(?i)heroku(.{0,20})?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`), []string{}, "?", }, { "MailChimp API key", "MailChimp API key", - `[0-9a-f]{32}-us[0-9]{1,2}`, + *regexp.MustCompile(`[0-9a-f]{32}-us[0-9]{1,2}`), []string{}, "?", }, { "Mailgun API key", "Mailgun API key", - `key\-[0-9a-zA-Z]{32}`, + *regexp.MustCompile(`key\-[0-9a-zA-Z]{32}`), []string{}, "?", }, { "PayPal Braintree access token", "PayPal Braintree access token", - `access_token\$production\$[0-9a-z]{16}\$[0-9a-f]{32}`, + *regexp.MustCompile(`access_token\$production\$[0-9a-z]{16}\$[0-9a-f]{32}`), []string{}, "?", }, { "Picatic API key", "Picatic API key", - `sk\_live\_[0-9a-z]{32}`, + *regexp.MustCompile(`sk\_live\_[0-9a-z]{32}`), []string{}, "?", }, { "SendGrid API Key", "SendGrid API Key", - `SG\.[a-zA-Z0-9]{22}\.[a-zA-Z0-9]{43}`, + *regexp.MustCompile(`SG\.[a-zA-Z0-9]{22}\.[a-zA-Z0-9]{43}`), []string{}, "?", }, { "Slack Webhook", "Slack Webhook", - `https\:\/\/hooks\.slack\.com/services/T[0-9A-Za-z\-_]{8}/B[0-9A-Za-z\-_]{8}/[0-9A-Za-z\-_]{24}`, + *regexp.MustCompile(`https\:\/\/hooks\.slack\.com/services/T[0-9A-Za-z\-_]{8}/B[0-9A-Za-z\-_]{8}/[0-9A-Za-z\-_]{24}`), []string{}, "?", }, { "Stripe API key", "Stripe API key", - `(?i)stripe(.{0,20})?[sr]k_live_[0-9a-zA-Z]{24}`, + *regexp.MustCompile(`(?i)stripe(.{0,20})?[sr]k_live_[0-9a-zA-Z]{24}`), []string{}, "?", }, { "Square access token", "Square access token", - `sq0atp\-[0-9A-Za-z\-_]{22}|EAAAE[a-zA-Z0-9\-_]{59}`, + *regexp.MustCompile(`sq0atp\-[0-9A-Za-z\-_]{22}|EAAAE[a-zA-Z0-9\-_]{59}`), []string{}, "?", }, { "Square OAuth secret", "Square OAuth secret", - `sq0csp\-[0-9A-Za-z\-_]{43}`, + *regexp.MustCompile(`sq0csp\-[0-9A-Za-z\-_]{43}`), []string{}, "?", }, { "Twilio API key", "Twilio API key", - `(?i)twilio(.{0,20})?SK[0-9a-f]{32}`, + *regexp.MustCompile(`(?i)twilio(.{0,20})?SK[0-9a-f]{32}`), []string{}, "?", }, { "Dynatrace token", "Dynatrace token", - `dt0[a-zA-Z]{1}[0-9]{2}\.[A-Z0-9]{24}\.[A-Z0-9]{64}`, + *regexp.MustCompile(`dt0[a-zA-Z]{1}[0-9]{2}\.[A-Z0-9]{24}\.[A-Z0-9]{64}`), []string{}, "?", }, { "Shopify shared secret", "Shopify shared secret", - `shpss\_[a-fA-F0-9]{32}`, + *regexp.MustCompile(`shpss\_[a-fA-F0-9]{32}`), []string{}, "?", }, { "Shopify access token", "Shopify access token", - `shpat\_[a-fA-F0-9]{32}`, + *regexp.MustCompile(`shpat\_[a-fA-F0-9]{32}`), []string{}, "?", }, { "Shopify custom app access token", "Shopify custom app access token", - `shpca\_[a-fA-F0-9]{32}`, + *regexp.MustCompile(`shpca\_[a-fA-F0-9]{32}`), []string{}, "?", }, { "Shopify private app access token", "Shopify private app access token", - `shppa\_[a-fA-F0-9]{32}`, + *regexp.MustCompile(`shppa\_[a-fA-F0-9]{32}`), []string{}, "?", }, { "PyPI upload token", "PyPI upload token", - `pypi\-AgEIcHlwaS5vcmc[A-Za-z0-9-_]{50,1000}`, + *regexp.MustCompile(`pypi\-AgEIcHlwaS5vcmc[A-Za-z0-9-_]{50,1000}`), []string{}, "?", }, { "Bugsnag API Key", "Bugsnag API Key", - `(?i)(bs|bugsnag)(.{0,20})?[0-9a-f]{32}`, + *regexp.MustCompile(`(?i)(bs|bugsnag)(.{0,20})?[0-9a-f]{32}`), []string{}, "?", }, { "AWS cognito pool", "AWS Cognito pool", - `(us-east-1|us-east-2|us-west-1|us-west-2|sa-east-1):[0-9A-Za-z]{8}-[0-9A-Za-z]{4}` + - `-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}`, + *regexp.MustCompile(`(us-east-1|us-east-2|us-west-1|us-west-2|sa-east-1):[0-9A-Za-z]{8}-[0-9A-Za-z]{4}` + + `-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}`), []string{}, "?", }, { "S3 Bucket", "S3 Bucket", - `(?:[a-zA-Z0-9_-]+s3\.amazonaws\.com|[a-zA-Z0-9_.-]+amazonaws\.com|` + + *regexp.MustCompile(`(?:[a-zA-Z0-9_-]+s3\.amazonaws\.com|[a-zA-Z0-9_.-]+amazonaws\.com|` + `[a-zA-Z0-9-\.\_]+\.s3\.amazonaws\.com|s3\:\/\/[a-zA-Z0-9-\.\_]+|` + `s3\.amazonaws\.com/[a-zA-Z0-9-\.\_]+|` + - `oss\:\/\/[a-zA-Z0-9-\.\_]+)`, + `oss\:\/\/[a-zA-Z0-9-\.\_]+)`), []string{}, "?", }, { "Discord Webhook", "Discord Webhook", - `https\:\/\/discordapp\.com\/api\/webhooks\/[0-9]+/[A-Za-z0-9\-]+`, + *regexp.MustCompile(`https\:\/\/discordapp\.com\/api\/webhooks\/[0-9]+/[A-Za-z0-9\-]+`), []string{}, "?", }, { "Google Calendar URI", "Google Calendar URI", - `https\:\/\/(.*)calendar\.google\.com\/calendar\/[0-9a-z\/]+\/embed\?src=[A-Za-z0-9%@&;=\-_\.\/]+`, + *regexp.MustCompile(`https\:\/\/(.*)calendar\.google\.com\/calendar\/[0-9a-z\/]+\/embed\?src=[A-Za-z0-9%@&;=\-_\.\/]+`), []string{}, "?", }, { "Google OAuth Access Key", "Google OAuth Access Key", - `ya29\.[0-9A-Za-z\-_]+`, + *regexp.MustCompile(`ya29\.[0-9A-Za-z\-_]+`), []string{}, "?", }, { "Mapbox Token Disclosure", "Mapbox Token Disclosure", - `(pk|sk)\.eyJ1Ijoi\w+\.[\w-]*`, + *regexp.MustCompile(`(pk|sk)\.eyJ1Ijoi\w+\.[\w-]*`), []string{}, "?", }, { "Microsoft Teams Webhook", "Microsoft Teams Webhook", - `https\:\/\/outlook\.office\.com\/webhook\/[A-Za-z0-9\-@]+\/IncomingWebhook\/[A-Za-z0-9\-]+\/[A-Za-z0-9\-]+`, + *regexp.MustCompile(`https\:\/\/outlook\.office\.com\/webhook\/[A-Za-z0-9\-@]+\/IncomingWebhook\/[A-Za-z0-9\-]+\/[A-Za-z0-9\-]+`), []string{}, "?", }, { "Alibaba OSS Bucket", "Alibaba OSS Bucket", - `(?:[a-zA-Z0-9-\.\_]+\.oss-[a-zA-Z0-9-\.\_]+\.aliyuncs\.com|` + - `oss-[a-zA-Z0-9-\.\_]+\.aliyuncs\.com/[a-zA-Z0-9-\.\_]+)`, + *regexp.MustCompile(`(?:[a-zA-Z0-9-\.\_]+\.oss-[a-zA-Z0-9-\.\_]+\.aliyuncs\.com|` + + `oss-[a-zA-Z0-9-\.\_]+\.aliyuncs\.com/[a-zA-Z0-9-\.\_]+)`), []string{}, "?", }, { "Zendesk Secret Key", "Zendesk Secret Key", - `(?i)(?:zendesk)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + + *regexp.MustCompile(`(?i)(?:zendesk)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}` + `(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}` + - `([a-z0-9]{40})(?:['|\"|\n|\r|\s|\x60|;]|$)`, + `([a-z0-9]{40})(?:['|\"|\n|\r|\s|\x60|;]|$)`), []string{}, "?", },