Skip to content

Trigger depSASTer downstream when Gemfile.checksum changes

Nick Malcolm requested to merge master-patch-29a3 into master

What does this MR do and why?

AppSec are asked to review new & updated dependencies: https://docs.gitlab.com/ee/development/gemfile.html#request-an-appsec-review

New gems add an extra security risk for GitLab, and it is important to evaluate this risk before we ship this to production

Currently we look at the diff, manually review the changes on best-efforts basis, look at how popular the gem is, etc. But we have SAST tools so why not use them!

I have been working on automation around this, and created depSASTer: https://gitlab.com/gitlab-com/gl-security/appsec/tooling/depsaster. Read the README to understand how it works.

This will increase efficiency:

  • Contributors (who are team members) can self-review the SAST results
  • AppSec can review the SAST results if needed

Screenshots or screen recordings

From gitlab-org/gitlab's perspective, it uses the Downstream Pipeline Multi-project CI/CD pattern. Here's a test project emulating that:

Screenshot_2023-06-28_at_3.56.39_PM

The depSASTer will be triggered, and it runs async. Once it's done the MR is updated with something like the following:

Screenshot_2023-06-16_at_4.42.16_PM

Src: https://gitlab.com/gitlab-com/gl-security/appsec/tooling/depsaster-test-project/-/merge_requests/3#note_1433354557

More examples

Here are two more examples, but they were manually triggered. When this MR is merged, these are the types of comments that will be posted automatically.

Rollout

  • Merge this MR
  • Have a maintainer add the CI variable ENABLE_DEPSASTER with the value true

Risks

  • Breaking master pipelines
    • Prevent:
      • have someone with great CI/CD knowledge review this MR
      • the pipeline is allowed to fail
    • Response if it happens anyway:
      • remove ENABLE_DEPSASTER or set it to not true
      • revert this MR
  • It runs on forks, wasting CI/CD time

How to set up and validate locally

I created a test project which uses very similar CI yml, but obviously gitlab-org/gitlab is wayyyy more complex.

https://gitlab.com/gitlab-com/gl-security/appsec/tooling/depsaster-test-project/-/blob/main/.gitlab-ci.yml

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Nick Malcolm

Merge request reports