Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade gitleaks from v7.6.1 to v8.3.0 #830

Merged
merged 32 commits into from Mar 16, 2022

Conversation

secureCodeBoxBot
Copy link
Contributor

@secureCodeBoxBot secureCodeBoxBot commented Nov 23, 2021

This PR upgrades gitleaks from v7.6.1 to v8.3.0. This includes a number of breaking changes, see the release notes by Gitleaks, particularly that for v8.0.0.

SCB-specific changes

Gitleaks no longer supports cloning natively. To clone a repository, use an init container as described in the updated documentation.

Findings no longer contain direct link to commit. Since Gitleaks no longer clones, it also does not include repository information in its output. We thus removed the attributes.repo key from the finding, and the attributes.commit no longer contains a link to the repo by default, only the SHA of the commit. To add the link to the repo, you need to add a scan annotation called metadata.scan.securecodebox.io/git-repo-url and point it at the URL of the repository (e.g. https://github.com/secureCodeBox/secureCodeBox). Further details can be found in the documentation.

Scanning only commits from a specific timeframe now works natively. There is no longer a need to use our fork of gitleaks. See the description in the documentation. Closes #790.

We removed the default cascading rules. There is no longer the possibility to write a generic cascading rule that covers all possible ways of authenticating. You can find an example cascading rule that downloads a repository from GitHub here, use it as a basis and change the used scanner to Gitleaks with your chosen parameters.

We removed the default rulesets. The ScanType no longer ships with a set of default rules, as they were outdated and it is better to rely on the rulesets maintained by the Gitleaks team. Use the ruleset built into the scanner or provide your own using a ConfigMap.

Severity of the findings now more explicitly based on result tags. All findings are now classified as medium severity by default. When defining your own Gitleaks rulesets, you can set the tags "LOW" or "HIGH" to override the severity for findings matching a particular rule.

We now use the official Docker image. Before, we used a custom version of the image to work around some limitations of Gitleaks (i.e., being unable to control the return code, and the system not creating a report file if no findings were found). Both of these limitations have been addressed, so we now use the official Docker image of Gitleaks directly. This will be changed automatically when you update the Helm install (you do not need to make any manual changes) but it will lead to a new image being installed on your cluster.

@secureCodeBoxBot secureCodeBoxBot added dependencies Pull requests that update a dependency file scanner Implement or update a security scanner labels Nov 23, 2021
@malexmave
Copy link
Member

Oh my. This is going to be a larger operation if we include it. Let's discuss what to do about this once we have our team together again.

@malexmave
Copy link
Member

malexmave commented Dec 8, 2021

What will have to be done here:

  • Pull the version number up to the latest 8.X (there have been more releases)
  • Update the parser
  • Update the unit tests
  • Update the documentation (no more cloning directly from GitLeaks => use init containers, as described here for example)
  • Re-enable the version check in the CI files for SCB Bot

@malexmave malexmave added this to In progress in secureCodeBox v3 via automation Jan 10, 2022
@J12934 J12934 moved this from In progress to To do in secureCodeBox v3 Jan 10, 2022
@malexmave malexmave self-assigned this Jan 11, 2022
Signed-off-by: secureCodeBoxBot <securecodebox@iteratec.com>
@malexmave malexmave force-pushed the dependencies/upgrading-gitleaks-to-v8.0.0 branch from 08a65bf to a8db880 Compare January 11, 2022 07:32
malexmave and others added 2 commits January 11, 2022 07:34
Signed-off-by: GitHub Actions <securecodebox@iteratec.com>
Signed-off-by: Max Maass <max.maass@iteratec.com>
@malexmave malexmave changed the title [SCB-Bot] Upgraded gitleaks from v7.6.1 to v8.0.0 [SCB-Bot] Upgraded gitleaks from v7.6.1 to v8.2.7 Jan 11, 2022
@malexmave malexmave changed the title [SCB-Bot] Upgraded gitleaks from v7.6.1 to v8.2.7 Upgrade gitleaks from v7.6.1 to v8.2.7 Jan 11, 2022
@malexmave malexmave moved this from To do to In progress in secureCodeBox v3 Jan 11, 2022
@malexmave malexmave added the breaking Changes requiring a major release label Jan 12, 2022
Signed-off-by: Max Maass <max.maass@iteratec.com>
Signed-off-by: Max Maass <max.maass@iteratec.com>
Signed-off-by: Max Maass <max.maass@iteratec.com>
Signed-off-by: Max Maass <max.maass@iteratec.com>
@malexmave malexmave marked this pull request as draft January 20, 2022 15:11
malexmave and others added 4 commits January 20, 2022 15:12
Signed-off-by: GitHub Actions <securecodebox@iteratec.com>
Signed-off-by: Max Maass <max.maass@iteratec.com>
Signed-off-by: Max Maass <max.maass@iteratec.com>
Signed-off-by: GitHub Actions <securecodebox@iteratec.com>
malexmave and others added 9 commits January 25, 2022 13:30
Signed-off-by: Max Maass <max.maass@iteratec.com>
Signed-off-by: Max Maass <max.maass@iteratec.com>
Before Gitleaks 8.0, the parser used to construct a direct URL to
each detected commit based on the parameter used to clone the repo.
Since it can no longer clone repos, this is no longer feasible. However,
this commit adds the capability to pull the repo information from a scan
annotation and use that. It does not actually enforce that the provided
repository URL matches the one that was cloned in the init container -
it blindly trusts whatever data it is given.

Signed-off-by: Max Maass <max.maass@iteratec.com>
This improves consistency with the scope limiter annotations, which use
descriptors of a similar form.

Signed-off-by: Max Maass <max.maass@iteratec.com>
Signed-off-by: Max Maass <max.maass@iteratec.com>
Signed-off-by: Max Maass <max.maass@iteratec.com>
Signed-off-by: GitHub Actions <securecodebox@iteratec.com>
Signed-off-by: Max Maass <max.maass@iteratec.com>
Signed-off-by: Max Maass <max.maass@iteratec.com>
@malexmave
Copy link
Member

This is now ready to review. Please also review with an eye towards secureCodeBox/documentation#160 so that we may be able to close that as well.

@malexmave malexmave marked this pull request as ready for review January 25, 2022 14:15
@malexmave malexmave moved this from In progress to To Review in secureCodeBox v3 Jan 25, 2022
The git clone should use the --mirror option to ensure the full
repository is cloned. Otherwise the data may be incomplete. See
https://wwws.nightwatchcybersecurity.com/2022/02/11/gitbleed/

Signed-off-by: Max Maass <max.maass@iteratec.com>
Signed-off-by: Max Maass <max.maass@iteratec.com>
Signed-off-by: Max Maass <max.maass@iteratec.com>
Signed-off-by: Max Maass <max.maass@iteratec.com>
@Weltraumschaf Weltraumschaf added the planned Issues we will do in the next sprint. label Mar 2, 2022
@SebieF SebieF self-requested a review March 3, 2022 14:34
Copy link
Contributor

@SebieF SebieF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of nice work! Only a few comments/questions from my side. :)

scanners/gitleaks/examples/private-repository/scan.yaml Outdated Show resolved Hide resolved
scanners/gitleaks/Makefile Show resolved Hide resolved
@malexmave malexmave changed the title Upgrade gitleaks from v7.6.1 to v8.2.7 Upgrade gitleaks from v7.6.1 to v8.3.0 Mar 10, 2022
Signed-off-by: Max Maass <max.maass@iteratec.com>
@malexmave malexmave requested a review from SebieF March 10, 2022 12:18
secureCodeBox v3 automation moved this from To Review to Reviewer approved Mar 11, 2022
@J12934 J12934 merged commit afac405 into main Mar 16, 2022
secureCodeBox v3 automation moved this from Reviewer approved to Done Mar 16, 2022
@J12934 J12934 deleted the dependencies/upgrading-gitleaks-to-v8.0.0 branch March 16, 2022 16:32
@malexmave malexmave moved this from Done to counter in secureCodeBox v3 Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Changes requiring a major release dependencies Pull requests that update a dependency file planned Issues we will do in the next sprint. scanner Implement or update a security scanner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gitleaks: cannot use fork features
6 participants