semgrep_scan: Information about the CI job and other scan parameters, such as ignored files.- Sent every time a scan is run, including diff-aware scans, full scans, and scans that have no findings.
semgrep_finding: A single record of a new finding.- Sent based on how you have configured your notifications in Unified Policies. See Create a remediation policy.
semgrep_supply_chain_incident: Information about a Supply Chain incident declared by Semgrep’s Security Research team, including whether any of your projects are affected.- Sent if configured for the Early notification for Supply Chain incidents policy. See Supply Chain incidents.
Set up webhooks
Perform these steps in Semgrep AppSec Platform to set up webhooks:1
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.2
Turn notifications on:i. When creating or editing the desired policy, click Add action > Call a webhook, then select the webhook integration you created.
Test webhooks
To verify that Semgrep can post to your URL:1
Navigate to Settings > Integrations
2
Click the Test button of the webhook integration you want to test.
3
The following sample code in Python shows how to verify the signature in the
X-Semgrep-Signature-256 header: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
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:
Semgrep supply chain incident object
Note that thedescription and blog_url fields are optional and can be null.
TODO: Detail if the payload gets truncated
The following is an example of a semgrep_supply_chain_incident object sent by Semgrep: