Skip to content
GitLab
Next
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 44,761
    • Issues 44,761
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1,332
    • Merge requests 1,332
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.orgGitLab.org
  • GitLabGitLab
  • Issues
  • #243564
Closed
Open
Issue created Aug 31, 2020 by Zach Rice@zriceDeveloper4 of 4 checklist items completed4/4 checklist items

Update Gitleaks to v6.1.2 and add SECRET_DETECTION_COMMITS

Summary

An issue was raised on the gitleaks github page regarding the commit-to and commit-from options. Using these two options can lead to unintended commits being scanned and in the worst case, the entire repo's history could be scanned. A quick fix was put in to make scanning a range of commits deterministic by adding an option commits=<list of commits> and commits-file=<file of a list of commits>. Instead of having gitleaks git library (go-git) decide what commits to scan via git log, gitleaks scans ONLY the commits specified in commits-file and commits.

We need to update gitleaks to the most recent version v6.1.0 and add a SECRET_DETECTION_COMMITS variable to the secrets scanner so that gitleaks can accept a list of commits.

Implementation

  • Update Gitleaks to v6.1.2 in the Secrets analyzer
  • Add SECRET_DETECTION_COMMITS to scan a range of commits
  • Add a downstream test for range of commits
  • Update template Secret-Detection.gitlab.yml to use SECRET_DETECTION_COMMITS instead of SECRET_DETECTION_COMMIT_FROM/TO

Alternative Approach:

Disable the default secret-detection scan (which uses the problematic SECRET_DETECTION_COMMIT_FROM/TO options and use secret_detection_default_branch to match the same triggers as secret-sast. This would give us a little more breathing room and allow us to scope this issue for a future release.

Links / references

  • https://github.com/zricethezav/gitleaks/releases/tag/v6.1.0
  • https://github.com/zricethezav/gitleaks/issues/432
Edited Sep 04, 2020 by Zach Rice
Assignee
Assign to
Time tracking