Skip to content

Scan binary files #1541

@rgmz

Description

@rgmz

Is your feature request related to a problem? Please describe.
Gitleaks does not scan binary files, opting to skip them instead.

gitleaks/detect/git.go

Lines 24 to 27 in c5b15c9

// skip binary files
if gitdiffFile.IsBinary || gitdiffFile.IsDelete {
continue
}

Edit: it appears that Gitleaks does scan binary files if you do gitleaks dir but not if you do gitleaks git.

Describe the solution you'd like
Binary files should be scanned. A simple equivalent of strings $file would suffice for the initial implementation. The ability to scan more complex file types, such as archives, would be nice to have eventually.

  • Scan binary files
  • Unpack archives (e.g., zip, 7z, gzip, etc.)
    • Track and report nested file paths
  • Special handling for certain file extensions or mime types (e.g., sqlite)

Describe alternatives you've considered
N/A

Additional context
N/A

cc @zricethezav

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions