Skip to content

Running Gitleaks as a library throws X error(s) occurred: * Empty buffer #910

@Dentrax

Description

@Dentrax

Describe the bug
Gitleaks starting to throw X error(s) occurred: * Empty buffer errors after upgrade from v7 to v8.

To Reproduce

Initializing:

s.detector = detect.NewDetector(s.cfg)
s.detector.Verbose = true
s.detector.Redact = true
cloneCmd := exec.Command("git", []string{"clone", "--depth=1", cloneURL, projectClonePath}...)
cloneCmd.Stdout = os.Stdout
cloneCmd.Stderr = os.Stderr
err = cloneCmd.Start()
if err != nil {
	return fmt.Errorf("could not clone project: %s: %v\n", p.HTTPURLToRepo, err)
}

err = cloneCmd.Wait()
if err != nil {
	return fmt.Errorf("could not clone project: %s: %v\n", p.HTTPURLToRepo, err)
}

findings, err := s.detector.DetectFiles(projectClonePath)
if err != nil {
	return fmt.Errorf("[could not detect from files for project '%s' at '%s': %s\n", p.Name, projectClonePath, err.Error())
}

Resulted error is like following:

5 error(s) occurred:
* Empty buffer
* Empty buffer
* Empty buffer
* Empty buffer
* Empty buffer

I think those are throwing from fatih/semgroup#86 library.

Expected behavior
It should work as expected?

Screenshots
-

Basic Info (please complete the following information):

  • OS: Linux
  • Gitleaks Version: 8.8.11

Additional context

Any ideas on this? 🤔

cc @zricethezav

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions