Skip to content

Commit d4c3391

Browse files
authored
Ignore safedir when scanning git repo (#438)
1 parent f7f8b2d commit d4c3391

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.17
44

55
replace github.com/jpillora/overseer => github.com/trufflesecurity/overseer v1.1.7-custom4
66

7-
replace github.com/zricethezav/gitleaks/v8 => github.com/trufflesecurity/gitleaks/v8 v8.6.1-custom1
7+
replace github.com/zricethezav/gitleaks/v8 => github.com/trufflesecurity/gitleaks/v8 v8.6.1-custom3
88

99
require (
1010
cloud.google.com/go/secretmanager v1.4.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
447447
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
448448
github.com/tailscale/depaware v0.0.0-20210622194025-720c4b409502 h1:34icjjmqJ2HPjrSuJYEkdZ+0ItmGQAQ75cRHIiftIyE=
449449
github.com/tailscale/depaware v0.0.0-20210622194025-720c4b409502/go.mod h1:p9lPsd+cx33L3H9nNoecRRxPssFKUwwI50I3pZ0yT+8=
450-
github.com/trufflesecurity/gitleaks/v8 v8.6.1-custom1 h1:HJPy+ciKU82lFPK0cxXJ4BYvCIANCQp29zhjU2T1UXo=
451-
github.com/trufflesecurity/gitleaks/v8 v8.6.1-custom1/go.mod h1:TxBuxH8eB/1la8Mc7I6j/ZZYNG/mHGpoi09N2oHx5nQ=
450+
github.com/trufflesecurity/gitleaks/v8 v8.6.1-custom3 h1:Xc61NkfI7aDHd8eHa0gglK0ZVF5UF54M4u4C5tuAKcw=
451+
github.com/trufflesecurity/gitleaks/v8 v8.6.1-custom3/go.mod h1:Em2rda83ePrhmaX4ZdvNjnUADRiOJirEAqln0ZtN8og=
452452
github.com/trufflesecurity/overseer v1.1.7-custom4 h1:5ed5+2+N3ZaW7oc4n7PIjkybGHUZmdCH9iAztB/2+Cc=
453453
github.com/trufflesecurity/overseer v1.1.7-custom4/go.mod h1:nT9w37AiO1Nop2VhVhNfzAFaPjthvxgpDV3XKsxYkcI=
454454
github.com/xanzy/go-gitlab v0.63.0 h1:a9fXpKWykUS6dowapFej/2Wjf4aOAEFC1q2ZIcz4IpI=

pkg/sources/git/git.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,15 @@ func (s *Git) ScanCommits(repo *git.Repository, path string, scanOptions *ScanOp
268268

269269
// Errors returned on errChan aren't blocking, so just ignore them.
270270
errChan := make(chan error)
271-
fileChan, err := glgo.GitLog(path, scanOptions.HeadHash, errChan)
271+
var gitLogArgs []string
272+
if scanOptions.HeadHash != "" {
273+
gitLogArgs = append(gitLogArgs, scanOptions.HeadHash)
274+
}
275+
logOpts := glgo.LogOpts{
276+
Args: gitLogArgs,
277+
DisableSafeDir: true,
278+
}
279+
fileChan, err := glgo.GitLog(path, logOpts, errChan)
272280
if err != nil {
273281
return errors.WrapPrefix(err, "could not open repo path", 0)
274282
}

0 commit comments

Comments
 (0)