mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 12:44:22 +01:00
Bugfix/1352 incorrect report multiple lines (#1501)
* fix: add logic to modify endline & endcolumn * doc: update comment for #1352 * test: adding test file * chore: updating generic rule * test: adding test to TestFromFile #1352 & change static viper ConfigName * chore: remove interim fix for #1352 * fix: adjust matchIndex[1] to fix #1352 * test: adjust expectedFinding in TestFromFiles * chore: go fmt * test: rm identification of start/endlineIndex * fix: rm unused fmt pkg
This commit is contained in:
1 parent
ed19c4e8b4
commit
f8dcd838da
5 files changed
+38
-4
No files matched your search
+22
-1
@@ -603,11 +603,32 @@ func TestFromFiles(t *testing.T) {
|
||||
cfgName: "simple",
|
||||
expectedFindings: []report.Finding{},
|
||||
},
|
||||
{
|
||||
source: filepath.Join(repoBasePath, "nogit", ".env.prod"),
|
||||
cfgName: "generic",
|
||||
expectedFindings: []report.Finding{
|
||||
{
|
||||
Description: "Generic API Key",
|
||||
StartLine: 4,
|
||||
EndLine: 4,
|
||||
StartColumn: 5,
|
||||
EndColumn: 35,
|
||||
Match: "PASSWORD=8ae31cacf141669ddfb5da",
|
||||
Secret: "8ae31cacf141669ddfb5da",
|
||||
Line: "\nDB_PASSWORD=8ae31cacf141669ddfb5da",
|
||||
File: "../testdata/repos/nogit/.env.prod",
|
||||
RuleID: "generic-api-key",
|
||||
Tags: []string{},
|
||||
Entropy: 3.5383105,
|
||||
Fingerprint: "../testdata/repos/nogit/.env.prod:generic-api-key:4",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
viper.AddConfigPath(configPath)
|
||||
viper.SetConfigName("simple")
|
||||
viper.SetConfigName(tt.cfgName)
|
||||
viper.SetConfigType("toml")
|
||||
err := viper.ReadInConfig()
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in new issue
Block a user