Semgrep sends two types of JSON objects: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.
semgrep_scan JSON objectA
semgrep_scan object contains information about the CI job and other scan parameters, such as ignored files. Semgrep sends a single semgrep_scan object every time a scan is run. This includes diff-aware scans, full scans, and scans that have no findings.
semgrep_finding JSON objectA
semgrep_finding object is a single record of a new finding. Semgrep sends new semgrep_finding objects based on how you have configured your notifications in Policies. See Set up webhooks to learn more.
Set up webhooks
Perform these steps in Semgrep AppSec Platform to set up webhooks:Create a webhook integration:i. On the navigation menu, click Settings > Integrations > Add.ii. Click Webhook.iii. In the Name field, enter a name for the integration.iv. In the Webhook URL field, enter the target webhook URL for the integration.v. Optional: Provide a Signature Secret. The secret must be at least 15 characters long. If you provide a secret, Semgrep sends an
X-Semgrep-Signature-256 signature header with the payload.vi. Optional: If you use the Semgrep Network Broker, and your webhook URL is only accessible from your private network, enable the Use Network Broker toggle.vii. Click Subscribe.Turn notifications on:i. Click Rules > Policies > Rule Modes.ii. Click the Edit button of the Rule Mode for which you want to receive webhook notifications. For example, if you want to be notified of all blocking findings through webhooks, click the Edit button of the Block mode.iii. Repeat the previous step for all Rule Modes that you want to receive notifications for.
Test webhooks
To verify that Semgrep can post to your URL:Notification and alert de-duplication
Notifications are sent only the first time a given finding is detected. When running a diff-aware scan, Semgrep doesn’t notify you when a pull request has a finding that existed on the base branch already, even if that line is moved or re-indented. Semgrep also tracks notifications that have already been sent, so subsequent scans of the same changes in a pull request won’t result in duplicate notifications.NOTESee Findings in CI for more information about how Semgrep tracks a finding through its lifetime.
Semgrep findings object
Currently, only Semgrep Code (SAST) findings are sent through webhooks. Thenumeric_id field represents the finding’s ID in Semgrep AppSec Platform.
The following is an example of a semgrep_finding object sent by Semgrep:
Semgrep scan object
The following is an example of asemgrep_scan object sent by Semgrep: