Semgrep step configuration
Scan code repositories with Semgrep.
You can scan your code repositories using Semgrep and ingest the results into STO.
For a quick introduction, go to the SAST code scans using Semgrep tutorial.
Important notes for running Semgrep scans in STO
This integration uses the Semgrep Engine, which is open-source and licensed under LGPL 2.1.
To run scans using a licensed version of Semgrep Code, add your Semgrep token in the Access token field.
STO Semgrep steps include the following rulesets by default:
Some rulesets include Pro rules that are available only with a paid version of Semgrep. For more information, go to the Semgrep Registry.
If you want to add trusted certificates to your scan images at runtime, you need to run the scan step with root access.
You can set up your STO scan images and pipelines to run scans as non-root and establish trust for your proxies using custom certificates. For more information, go to Configure your pipeline to use STO images from private registry.
The following topics contain useful information for setting up scanner integrations in STO:
Set-up workflows
Semgrep step configuration
The recommended workflow is to add a Semgrep step to a Security Tests or CI Build stage and then configure it as described below.
Scan
Scan Mode
Scan Configuration
You can use this setting to select the set of Semgrep rulesets to include in your scan:
Default Include the following rulesets:
No default CLI flags Run the
semgrepscanner with no additional CLI flags. This setting is useful if you want to specify a custom set of rulesets in Additional CLI flags.p/default Run the scan with the default ruleset configured for the Semgrep scanner.
Auto only Run the scan with the recommended rulesets specific to your project.
Auto and Ported security tools Include the following rulesets:
Auto and Ported security tools except p/gitleaks
Target
Type
Target and variant detection
Name
Variant
Workspace
Ingestion File
Access Token
Log Level
Additional CLI flags
Use this field to run the semgrep scanner with flags such as:
--severity=ERROR --use-git-ignore
With these flags, semgrep considers only ERROR severity rules and ignores files included in .gitignore.
Fail on Severity
Settings
Additional Configuration
Advanced settings
Configure Semgrep as a Built-in Scanner
The Semgrep scanner is available as a built-in scanner in STO. Configuring it as a built-in scanner enables the step to automatically perform scans using the free version without requiring any licenses. Follow these steps to set it up:
Search for SAST in the step palette or navigate to the Built-in Scanners section and select the SAST step.
Expand the Additional CLI Flags section if you want to configure optional CLI flags.
Click Add Scanner to save the configuration.
The scanner will automatically use the free version, detect scan targets, and can be further configured by clicking on the step whenever needed.
Proxy settings
YAML pipeline example
The following pipeline example illustrates an orchestration workflow. It consists of a Semgrep step that scans a code repository and then ingests, normalizes, and deduplicates the results.
Last updated
Was this helpful?