The automation and integration of Application Security Testing (AST) is essential for building out a true DevSecOps program. Automation is the easy part. Invoke a security scanners’ REST API or a command line interface inside a pipeline and you can get automated scans. The key, and more tricky part, is integration. What I mean by that is having the ability to integrate the security scanners’ results within their CI/CD tooling to make a security assessment without having to leave the CI/CD ecosystem is desired.
Announced today, we’re thrilled to share that CxSAST, CxSCA, and CxCodebashing all now integrate seamlessly within GitLab’s ecosystem via CxFlow: Checkmarx’s scan and result orchestration application.
Below is a high-level overview on integrating Checkmarx security into GitLab’s user interface.
GitLab’s users, whether they are Software Developers, DevOps, or AppSec engineers, want to consume as much of the application security scanner’s results as possible within GitLab. GitLab is already a complete DevOps platform from managing -> to planning -> to creating -> to releasing, so it is just common sense GitLab users would want to have security directly within GitLab. GitLab users can consume Checkmarx security-related vulnerability results at three different integration points:
- Merge Request Overviews
- GitLab Issues
- Security Dashboard (for GitLab Gold/Ultimate tier or public projects)
Every organization, even teams within the organization, will want to run security scanners at different points of the SDLC, but by best practice from Checkmarx, it is suggested to scan at the Merge Request stage. With security scanning completed at the Merge Request stage, an assessment can be performed with the scan results and the merge can be blocked, or GitLab Issues can be created. But, what kind of result data should be consumed?
- High level summary of CxSAST & CxSCA findings
- Data flow from source to sink within the source code
- Short summary of the specific vulnerability that was identified
- Links to just-in-time training (CxCodebashing) and online resources for remediation
- Links into Checkmarx platform for even more comprehensive results
CxFlow – Under the Hood
Checkmarx maintains a spring boot application called CxFlow, which acts as a scan and results orchestration tool to automate security scans and integrate the results into CI/CD tools such as GitLab. Some key features and capabilities include:
- Scan Initiation – CLI or Webhook Events
- CxFlow can be configured in two different ways: using CxFlow from a command line interface or have CxFlow work as a server and listen for Webhook events. Once an event is triggered or received, the initiation of a Checkmarx scan will occur automatically.
- Merge requests, or even commits of the source, will trigger an existing pipeline within GitLab’s CI/CD and initiate a scan via CxFlow; the existing pipeline just needs an edit to include a stage that will invoke CxFlow.
- The scan initiation will either create a new project if it does not exist or update a current one.
- Results Management
- As far as consuming results, the scan results are file based (csv, json, or xml) making it easy to import into defect tracking systems or dashboards.
- CxFlow also drives a result feedback loop eliminating having to do manual intervention (opening and even closing defects).
- You can always filter the results created based on any filtering criteria.
- The results are easy to consume, in a way developers want to consume and most importantly, actionable.
- Defect Tracking
- Consolidates issues of the same vulnerability type in the same file – instead of multiple issues, it is just one.
- Once all references to the vulnerability type of that issue are fixed, the ticket will automatically close.
- You can base it on policy – severity / CWE / vulnerability type or state (urgent / confirmed).
- Defect tracking is also supported for both CxSAST and CxSCA results.
- Feedback Channels
- Not only does it support GitLab Security Dashboard and GitLab Issues, but also Jira, Email, Service Now and Rally.
- Ease of Consuming the AST Service
- Effortless option for the development teams to quickly scan projects.
- There is no overhead when configuring and managing builds.
- Mass Effortless Scan Configuration
- You can quickly automate the scan of multiple repositories.
- Again, there is no overhead when configuring and managing builds of many repos.
- Automation with Developers’ Common Toolsets
- In this case, GitLab.
- You want to get the details of issues to those who must address them – the developers.
- Drive security testing based on GitLab activity.
- Publish issues to existing backlogs.
- Keep developers within GitLab.
- Eliminate Unnecessary Manual Tasks with Checkmarx Automation Capabilities
- Free up time to focus on things that matter.
- Shift as far left as possible.
- Constantly scanning the latest code.
- Replaces need to scan in the IDE.
GitLab / Checkmarx Workflow
Below is a visual picture of the Checkmarx workflow with GitLab’s CI/CD.
Now let’s describe this flow in more detail:
- Setting Variables
Variables are needed to perform Checkmarx authentication and to define Checkmarx scan settings read by CxFlow. This can be set up per project or by “groups”. GitLab has an awesome feature where you can have a file as a Variable. We leverage this feature and have CxFlow’s yaml configuration file as a Variable.
- Defining a Stage
Per GitLab best practice, application security testing should be done during the “test” stage of the pipeline. During the test stage of the pipeline, GitLab will pull the Checkmarx docker container where CxFlow CLI is stored. CxFlow CLI should then be invoked to initiate the scan based on the settings defined in the config file Variable.
- CxFlow CLI Initiates the Scan
CxFlow receives the request with the Checkmarx project settings and the GitLab repository details. CxFlow performs the authentication into the Checkmarx server and then initiates a scan. It will wait for the scan to finish.
- Checkmarx Performs SAST & SCA Scans
- CxFlow Parses Results and Updates GitLab
CxFlow waits until the scan is done, parses the results and will update the Security Dashboard, GitLab Issues, the Merge Request Discussion, or all three. If the issue has been fixed, it will automatically close it.
For full integration steps, please visit us at https://checkmarx.com/gitlab.