8000 Added new SAST scanner `semgrep` by malexmave · Pull Request #744 · secureCodeBox/secureCodeBox · GitHub
[go: up one dir, main page]

Skip to content

Added new SAST scanner semgrep#744

Merged
rfelber merged 26 commits intomainfrom
feature/add-scanner-semgrep
Oct 24, 2021
Merged

Added new SAST scanner semgrep#744
rfelber merged 26 commits intomainfrom
feature/add-scanner-semgrep

Conversation

@malexmave
Copy link
Member
@malexmave malexmave commented Oct 19, 2021

Description

This PR adds semgrep as a new scanner to the secureCodeBox. Closes #595. Creating this as a draft PR while I do one last sanity check and to see what the CI thinks about it, but should generally be ready.

Since I accidentally committed to the wrong branch, this PR also includes a change to the integration test system to add support for initContainers, as this was used by some integrations tests (which I have since commented out because they used external Git repositories for testing).

It does not contain default cascading scan rules, but gives an example for one in the documentation.

Checklist

  • Test your changes as thoroughly as possible before you commit them. Preferably, automate your test by unit/integration tests.
  • Make sure npm test runs for the whole project.
  • Make codeclimate checks happy
  • Add support for semgrep to the DefectDojo hook (WIP, will add soon)

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>
The old version of the integration test framework did not have support
for the new initContainer syntax introduced in ADR-0009. This commit
adds this support, which is necessary for the semgrep integration tests

Signed-off-by: Max Maass <max.maass@iteratec.com>
These tests require network access to download test files, as I do not
know of a good way to provision the test files for them. Alternatives
are appreciated.

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>
Signed-off-by: Max Maass <max.maass@iteratec.com>
We do not want to save the matched lines into the s3 bucket without
encryption, as the lines may include sensitive information.

Signed-off-by: Max Maass <max.maass@iteratec.com>
The semgrep scanner will not ship with default cascadingRules, so we
provide documentation on how to write your own instead.

Signed-off-by: Max Maass <max.maass@iteratec.com>
We do not want to retrieve files from the Internet for the integration
tests, so the test now uses a local file in the repo.

Signed-off-by: Max Maass <max.maass@iteratec.com>
@malexmave malexmave added the scanner Implement or update a security scanner label Oct 19, 2021
@malexmave malexmave self-assigned this Oct 19, 2021
DefectDojo supports semgrep, so this commit adds support for the semgrep
results to the DD hook. It works fine on individual scans, but I still
want to do some more testing before merging this.

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>
Signed-off-by: Max Maass <max.maass@iteratec.com>
@malexmave malexmave marked this pull request as ready for review October 21, 2021 06:29
@malexmave
Copy link
Member Author

The PR is ready for review now. There are still some issues with the DefectDojo importer, but these appear to be unrelated to my changes, so it will be tracked in a separate issue: #746

@malexmave malexmave requested a review from rfelber October 21, 2021 06:31
@rfelber
Copy link
Member
rfelber commented Oct 21, 2021

The generate helm docs GitHub Action seems to be broken because not all docs files are generated here 🤔

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

grafik

Seems to be broken indeed

@malexmave
Copy link
Member Author

What is currently missing in the semgrep scanner is a way to explicitly state in the results which repository was scanned. The semgrep result JSON do not contain this information (let alone the exact Git commit ID). If there is a good way to include this somehow, give me a pointer how and I'd be happy to implement it.

malexmave and others added 6 commits October 21, 2021 09:26
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>
Signed-off-by: GitHub Actions <securecodebox@iteratec.com>
rfelber
rfelber previously approved these changes Oct 22, 2021
Copy link
Member
@rfelber rfelber left a comment

Choose a reason for hiding this comment

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

Love this thing 😍 Thx alot @malexmave !

Signed-off-by: Max Maass <max.maass@iteratec.com>
@rfelber rfelber merged commit 3d3c0fc into main Oct 24, 2021
@rfelber rfelber deleted the feature/add-scanner-semgrep branch October 24, 2021 14:53
@rfelber rfelber changed the title Add Semgrep scanner Added new SAST scanner semgrep Oct 24, 2021
@rfelber rfelber added the enhancement New feature or request label Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request scanner Implement or update a security scanner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add semgrep as new scanner for static analysis

3 participants

0