File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
pkg/detectors/smartsheets Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 22
22
client = common .SaneHttpClient ()
23
23
24
24
// Make sure that your group is surrounded in boundary characters such as below to reduce false positives.
25
- keyPat = regexp .MustCompile (detectors .PrefixRegex ([]string {"sheet" }) + `\b([a-zA-Z0-9]{37})\b` )
25
+ keyPat = regexp .MustCompile (detectors .PrefixRegex ([]string {"sheet" }) + `\b([a-zA-Z0-9]{26}|[a-zA-Z0-9]{ 37})\b` )
26
26
)
27
27
28
28
// Keywords are used for efficiently pre-filtering chunks.
Original file line number Diff line number Diff line change @@ -55,6 +55,31 @@ func TestSmartsheets_Pattern(t *testing.T) {
55
55
` ,
56
56
want : []string {},
57
57
},
58
+ {
59
+ name : "valid pattern - 26 characters" ,
60
+ input : `
61
+ # smartsheet credentials
62
+ sheet_token := "fakeiq999fakeecyfake3ifake"
63
+ ` ,
64
+ want : []string {"fakeiq999fakeecyfake3ifake" },
65
+ },
66
+ {
67
+ name : "valid pattern - 26 and 37 characters" ,
68
+ input : `
69
+ # smartsheet multiple length credentials
70
+ sheet_token := "fakeiq999fakeecyfake3ifake"
71
+ sheet_token2 := "fakezmdxfakenFAKELzhonda7tvMpkqJ3fake"
72
+ ` ,
73
+ want : []string {"fakeiq999fakeecyfake3ifake" , "fakezmdxfakenFAKELzhonda7tvMpkqJ3fake" },
74
+ },
75
+ {
76
+ name : "invalid pattern - 30 characters" ,
77
+ input : `
78
+ # smartsheet invalid credentials
79
+ sheet_token := "fakeiq999fakeecyfake3ifakeuiop"
80
+ ` ,
81
+ want : []string {},
82
+ },
58
83
{
59
84
name : "invalid pattern" ,
60
85
input : `
You can’t perform that action at this time.
0 commit comments