Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
Fix binary file hanging bug in git sources (#2388)
Miccah01c9ac7b593d
diff --git a/pkg/gitparse/gitparse.go b/pkg/gitparse/gitparse.goindex 4a3731245..627546793 100644--- a/pkg/gitparse/gitparse.go+++ b/pkg/gitparse/gitparse.go@@ -375,6 +375,9 @@ func (c *Parser) executeCommand(ctx context.Context, cmd *exec.Cmd, isStaged boogo func() {c.FromReader(ctx, stdOut, commitChan, isStaged)+ if err := stdOut.Close(); err != nil {+ ctx.Logger().V(2).Info("Error closing git stdout pipe.", "error", err)+ }if err := cmd.Wait(); err != nil {ctx.Logger().V(2).Info("Error waiting for git command to complete.", "error", err)}diff --git a/pkg/sources/git/git.go b/pkg/sources/git/git.goindex 7a7de1ddb..279b9acaa 100644--- a/pkg/sources/git/git.go+++ b/pkg/sources/git/git.go@@ -1143,6 +1143,9 @@ func (s *Git) handleBinary(ctx context.Context, gitDir string, reporter sources.return err}defer func() {+ if err := fileReader.Close(); err != nil {+ ctx.Logger().Error(err, "error closing fileReader")+ }if err := cmd.Wait(); err != nil {ctx.Logger().Error(err, "error waiting for command",