Documentation Index
Fetch the complete documentation index at: https://docs.semgrep.dev/llms.txt
Use this file to discover all available pages before exploring further.
YOUR DEPLOYMENT JOURNEY
- You have gained the necessary resource access and permissions required for deployment.
- You have created a Semgrep account and organization.
- You have connected your source code manager.
- Optionally, you have set up SSO.
- You have successfully added a Semgrep job to your CI workflow with diff-aware scanning.

Conditions for MR comment creation
MR comments appear for the following types of scans under these conditions:| Type of scan | Product name | Trigger condition | How to set up |
|---|---|---|---|
| Static application security testing (SAST) | Semgrep Code | A comment appears when a finding is generated by a rule in Comment or Block mode. This means you can fully customize what comments your developers receive. | Complete the steps in the following sections: 1. Confirm your Semgrep account’s connection and access to your source code manager. 2. Configure comments for Semgrep Code. |
| Software composition analysis (SCA) | Semgrep Supply Chain (SSC) | A comment appears based on the conditions you explicitly set in a Supply Chain policy or when Semgrep detects a license violation. | To receive Supply Chain comments, complete the steps in Confirm account connection and access and set up a policy. To receive license violation comments, enable dependency search. |
| Secrets | Semgrep Secrets | A comment appears when a finding is generated by a rule in Comment or Block mode. A comment also appears for invalid findings and validation errors if these conditions are set to Comment or Block mode. | Complete the steps in the following sections: 1. Confirm your Semgrep account’s connection and access to your source code manager. 2. Configure comments for Semgrep Secrets. |
A description of the vulnerability, including the types of attack it is vulnerable to. Fix
Indicates what versions to upgrade to, if any, that resolves or eliminates the vulnerability. Reference
A link to additional information about the vulnerability from its source, such as the GitHub Advisory Database and the National Vulnerability Database (NVD), if available.
Steps to set up MR comments
Confirm your Semgrep account’s connection
PR comments are enabled by default for users who have connected their GitLab group to Semgrep AppSec Platform. Confirm that you have the correct connection and access:Triage through MR comments
Developers can triage Semgrep findings without leaving GitLab by responding to the MR comments authored by Semgrep. To use this feature, you must have a paid GitLab plan, and must update your source code manager (SCM) connection to use an access token with an elevated role. This allows you to enable webhooks, which Semgrep requires for the triage through MR comments feature. Ensure that you’re using one of the following GitLab plans:- GitLab Premium
- GitLab Ultimate
- GitLab Self Managed
Log in to GitLab, and create an access token with access to the desired GitLab groups. Assign the
api scope and one of the following roles:OwnerAdmin
Return to Semgrep and sign in.
In the Update access token dialog that appears, provide the new token you created. Click Update to save and proceed.
Developer.
Configure comments for Semgrep Code
In addition to setting up the connection between Semgrep and GitLab, you must assign rules to Comment or Block mode. This customization enables you to:- Manage the amount of PR comments your developers receive.
- Ensure that only rules that meet your criteria, such as high severity or high confidence rules, produce comments visible to developers, reducing noise.
Set rules to Comment or Block mode
The following instructions let you customize what findings or security issues your developers see as comments in their PRs:In your Semgrep AppSec Platform account, click Rules > Policies to enter the Policies page. Under Modes , you can quickly see if you have existing rules in either Comment or Block mode.
Configure comments for Semgrep Secrets
In addition to setting up the connection between Semgrep and GitLab, you must assign rules to Comment or Block mode. This customization enables you to:- Manage the amount of PR comments your developers receive.
- Ensure that only rules that meet your criteria, such as high severity or high confidence rules, and result in findings involving valid secrets produce comments visible to developers, reducing noise.
Set rules to Comment or Block mode
The following instructions let you customize what findings or security issues your developers see as comments in their PRs:Under Modes , you can see if you have existing rules in either Comment or Block mode. You can also use the filters to find rules you want to set to Comment or Block.
Validation state policies
Validation state policies allow you to define how Semgrep handles the following issues:- Invalid findings: the secret has been revoked, was never functional, or used for a custom or private endpoint that Semgrep can’t communicate with. For example, a Semgrep rule that tests GitHub credentials may return an invalid finding if Semgrep can’t communicate with an on-premise deployment.
- Validation errors: Semgrep was unable to reach the secrets provider to test the validity of the credential, or Semgrep received an unexpected response from the API
Configure comments for Semgrep Supply Chain
To configure comments for Supply Chain, you must define a Supply Chain policy. This policy lets you set the specific conditions, such as transitivity and reachability, that trigger a comment. These conditions are unique to Supply Chain findings. See the Policies documentation for more information.Receive comments in your VPN or on-premise SCM
If you are behind a firewall, are using a virtual private network (VPN), or have network restrictions regarding access, you may need to add the following IP addresses to the ingress allowlist and egress allowlist:Additional egress IP addresses
You must also add CloudFront IP addresses to your egress allowlist. Refer to Locations and IP address ranges of CloudFront edge servers for a list of IP addresses.Test your configuration
Test that you are able to receive findings by manually triggering a scan through your CI provider. Receiving PR or MR comments may require additional steps depending on the custom configuration of your VPN or SCM (for example, if you use a static IP without a hostname). Reach out to Semgrep Support with any concerns. You’ve set up MR comments! Enable optional features provided in the following sections, or see Next steps.Optional features
Enable Rule-defined fix in GitLab repositories
Rule-defined fix is a Semgrep feature in which rules contain suggested fixes to resolve findings. To enable Rule-defined fix for all projects in your Semgrep AppSec Platform organization, follow these steps:Dataflow traces in MR comments
With dataflow traces, Semgrep Code provides you a visualization of the path of tainted, or untrusted, data in specific findings. This path can help you track the sources and sinks of the tainted data as they propagate through the body of a function or a method. For general information about taint analysis, see Taint tracking. You can view dataflow traces in the MR comments created by Semgrep Code.View the path of tainted data in MR comments
To enable dataflow traces in your MR comments, fulfill the following prerequisites:- Set up Semgrep to post GitLab merge request comments, as described on this page.
- To get the most meaningful results of dataflow traces in MR comments, use cross-file analysis while scanning your repositories. To enable cross-file analysis, see Perform cross-file analysis.
- Not all Semgrep rules or rulesets make use of taint tracking. Ensure that you have a ruleset such as the default ruleset added to your Policies. If this ruleset is not added, go to https://semgrep.dev/p/default, and then click Add to Policy. You can add rules that use taint tracking from Semgrep Registry.
Customize MR comments
You can customize the comments Semgrep leaves on your PR. Custom comments allow you to direct your teams to the resources they need to handle the vulnerabilities Semgrep identifies in their code.
Sign in to Semgrep AppSec Platform.
Provide a custom comment for each Semgrep product whose findings you want to generate a PR comment. Semgrep supports HTML, Markdown, and plaintext links in your message.
Next steps
You’ve finished setting up a core deployment of Semgrep 🎉.- Explore recommended tasks after deployment in Beyond core deployment.
