Escape - character in regex character groups (#802)

* fix char escape

* add test

* fix verbosity in make test
This commit is contained in:
Isaac Dawson authored and GitHub committed 2022-03-07 08:33:06 -06:00
1 parent 19555579c8
commit 9326f35380
5 files changed
+34 -13

No files matched your search

+19
View File
@@ -22,6 +22,25 @@ func TestDetectFindings(t *testing.T) {
expectedFindings []report.Finding
wantError error
}{
{
cfgName: "escaped_character_group",
bytes: []byte(`pypi-AgEIcHlwaS5vcmcAAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAAB`),
filePath: "tmp.go",
expectedFindings: []report.Finding{
{
Description: "PyPI upload token",
Secret: "pypi-AgEIcHlwaS5vcmcAAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAAB",
Match: "pypi-AgEIcHlwaS5vcmcAAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAA-AAAAAAAAAAB",
File: "tmp.go",
RuleID: "pypi-upload-token",
Tags: []string{"key", "pypi"},
StartLine: 1,
EndLine: 1,
StartColumn: 1,
EndColumn: 86,
},
},
},
{
cfgName: "simple",
bytes: []byte(`awsToken := \"AKIALALEMEL33243OLIA\"`),