Skip to content

Commit 16ab0fd

Browse files
authored
update info re: Assistant memories and noise filtering (#1903)
1 parent d4cb60f commit 16ab0fd

14 files changed

+172
-27
lines changed

docs/semgrep-appsec-platform/dashboard.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@ A low or 0 value for **Total net new** is ideal as it indicates that findings ar
171171

172172
## Secure guardrails
173173

174-
This provides an overview of how secure guardrails in **PR or MR comments** are used in your organization. Other guardrail interfaces, such as the IDE or `pre-commit`, are not counted in this section.
174+
This provides an overview of how secure guardrails in **PR or MR comments** are used in your organization, as well as how often [Semgrep Assistant, if enabled, filters out false positives](/semgrep-assistant/overview#noise-filtering) and suppresses PR or MR comments, reducing noise for developers. Other guardrail interfaces, such as the IDE or `pre-commit`, are not counted in this section.
175175

176176
![Secure guardrails pane](/img/dashboard-guardrails.png)
177-
_**Figure**. Secure guardrails pane. Hover over the charts to view data for that point in time._
177+
_**Figure**. Secure guardrails pane. Hover over the charts to view data for that point in time. Click on Filtered by Assistant data to view filtered findings on Code > Pre-production._
178178

179179
### Key metrics
180180

@@ -191,7 +191,7 @@ _**Figure**. Secure guardrails pane. Hover over the charts to view data for that
191191
| Chart | Description |
192192
| ------- | ------ |
193193
| Secure guardrails adoption | Percent of new findings shown to developers over the specified time period. An upward or stable trend is better. |
194-
| Guardrails activity | This chart displays a breakdown of the status of findings shown to developers; whether they were ignored, fixed, or remained open. A greater **Fixed** value is better. |
194+
| Guardrails activity | This chart displays a breakdown of the status of findings shown to developers; whether they were ignored, fixed, remained open, or [filtered by Assistant](/semgrep-assistant/overview#noise-filtering). A greater **Fixed** value is better. |
195195

196196
## Most findings by project
197197

docs/semgrep-assistant/getting-started.md

+58-14
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ Semgrep Assistant requires [read access to your code in GitHub](https://docs.git
5555
4. When prompted, click **Continue** to allow redirection to GitHub to finalize app creation. Follow the instructions to finish creating and installing a private `semgrep-app`.
5656
4. You are redirected to Semgrep AppSec Platform's **Source Code Managers** page. Navigate back to the **Deployment** page. Under the **Assistant** section, verify that all of the features are enabled:
5757
1. **Allow code snippets in AI prompts**: Required for Semgrep to auto-triage findings, provide AI remediation guidance, and tag findings with code context.
58-
2. **Auto-triage for Code**: Enable notifications whenever Assistant suggests that a finding may be safe to ignore. You can include notifications in your PR and MR comments, or you can receive them through Slack notifications.
59-
3. **Autofix suggestions for Code**: Enable Assistant-generated autofix suggestions in comments from Assistant. You can also set the minimum confidence level for Assistant-written fixes if the Semgrep rule doesn't include a human-written autofix.
60-
![Semgrep Assistant toggle location](/img/semgrep-assistant-enable.png#md-width)
58+
2. **Weekly priority emails**: Enable weekly emails to all organization admins with information on Assistant's top three backlog tasks across all findings.
59+
3. **Noise filter for Code PR/MR comments**: Enable the filtering of findings flagged as false positives. You can choose to suppress any PR or MR comments Semgrep might push, or you can choose to show developers information regarding false positives using PR or MR comments.
60+
4. **Remediation**: Enable Assistant-generated autofix suggestions in comments from Assistant. You can also set the minimum confidence level for Assistant-written fixes if the Semgrep rule doesn't include a human-written autofix.
6161

6262
</TabItem>
6363

@@ -82,19 +82,19 @@ Semgrep Assistant requires the **API scope** to run in both GitLab SaaS and GitL
8282
1. Follow the on-screen instructions to complete the setup process.
8383
2. Navigate back to the **Deployment** page. Under the **Assistant** section, verify that all of the features are enabled:
8484
1. **Allow code snippets in AI prompts**: Required for Semgrep to auto-triage findings, provide AI remediation guidance, and tag findings with code context.
85-
2. **Autofix suggestions for Code**: Enable autofix suggestions in comments from Assistant. You can also set the minimum confidence level for Assistant-written fixes if the Semgrep rule doesn't include a human-written autofix.
86-
3. **Auto-triage for Code**: Enable notifications whenever Assistant suggests that a finding may be safe to ignore. You can include notifications in your PR and MR comments, or you can receive them through Slack notifications.
87-
![Semgrep Assistant toggle location](/img/semgrep-assistant-enable.png#md-width)
85+
2. **Weekly priority emails**: Enable weekly emails to all organization admins with information on Assistant's top three backlog tasks across all findings.
86+
3. **Noise filter for Code PR/MR comments**: Enable the filtering of findings flagged as false positives. You can choose to suppress any PR or MR comments Semgrep might push, or you can choose to show developers information regarding false positives using PR or MR comments.
87+
4. **Remediation**: Enable Assistant-generated autofix suggestions in comments from Assistant. You can also set the minimum confidence level for Assistant-written fixes if the Semgrep rule doesn't include a human-written autofix.
8888

8989
</TabItem>
9090
</Tabs>
9191

92-
### Enable autofix suggestions
92+
### Enable remediation
9393

94-
Assistant autofix allows you to receive AI-generated code snippets to remediate true positives. Perform the following to enable it:
94+
Assistant remediation allows you to receive AI-generated code snippets for true positives. Perform the following to enable it:
9595

9696
1. Sign in to Semgrep AppSec Platform, and navigate to **Settings > Deployment**.
97-
2. In the **Assistant** section, click the *Autofix suggestions for Code** <i class="fa-solid fa-toggle-large-on"></i> if it is not yet enabled.
97+
2. In the **Assistant** section, click the **Remediation** <i class="fa-solid fa-toggle-large-on"></i> if it is not yet enabled.
9898
3. *Optional*: Select a **confidence level** in the drop-down box. This value determines the level of quality at which the autofix code appears as a suggestion. A lower confidence level means that Semgrep Assistant displays the autofix suggestion even when the code quality may be incorrect.
9999
:::tip
100100
Semgrep recommends setting a low confidence level since even incorrect suggestions may be useful starting points for triage and remediation.
@@ -118,16 +118,37 @@ Semgrep Assistant messages only appear in your PR comments for rules that are se
118118
![ Policies modes](/img/semgrep-assistant-comment.png#md-width)
119119
* You have selected PR/MR comments in **Semgrep AppSec Platform > Settings > Deployment** in the **Code** section.
120120

121+
### Enable weekly priority emails
122+
123+
If [weekly priority emails](/semgrep-assistant/overview/#weekly-priority-emails), which allows organization admins to receive information on top backlog tasks according to Assistant, isn't enabled for your deployment, you can do so as follows:
124+
125+
1. Sign in to Semgrep AppSec Platform, and navigate to **Settings > Deployment**.
126+
2. In the **Assistant** section, click the **Weekly priority emails** <i class="fa-solid fa-toggle-large-on"></i> if it is not yet enabled.
127+
128+
### Enable noise filtering
129+
130+
Assistant is [over 95% accurate in categorizing Semgrep Code findings as false positives](/semgrep-assistant/metrics.md), so you can minimize the number of findings shown by enabling **Noise filter for Code PR/MR comments**. To do so:
131+
132+
1. Sign in to Semgrep AppSec Platform, and navigate to **Settings > Deployment**.
133+
2. In the **Assistant** section, click the **Noise filter for Code PR/MR comments** <i class="fa-solid fa-toggle-large-on"></i> if it is not yet enabled.
134+
3. Select whether you want to enable PR or MR comments:
135+
1. **Don’t leave a PR/MR comment**: Hide Semgrep’s comments on findings that are likely to be false positives. These findings are available for security review on the [**Code > Pre-production backlog** page](https://semgrep.dev/orgs/-/findings?tab=open&last_opened=All+time&backlog=preprod). Comments still appear for rules in [**Block** mode](/semgrep-code/policies#block-a-pr-or-mr-through-rule-modes).
136+
2. **Include a notification in the PR/MR comment**: Show developers likely false positive findings in PR/MR comments, but include a note explaining why Assistant thinks the finding may be safe to ignore.
137+
138+
Findings filtered out by Assistant can be reviewed at any time in Semgrep by going to the [**Code > Pre-production backlog** page](https://semgrep.dev/orgs/-/findings?tab=open&last_opened=All+time&backlog=preprod). Semgrep also allows you to agree with the filtering to close the finding or disagree to reopen.
139+
121140
## Add Memories (beta)
122141

123-
Assistant Memories allows AppSec teams and developers to tailor Assistant's remediation guidance to their organization's standards and defaults on a per-project, per-rule basis. Whenever Assistant gives a suggested fix, you can provide feedback by adding custom instructions.
142+
Assistant Memories allows admins to tailor Assistant's remediation guidance to their organization's standards and defaults on a per-project, per-rule basis. You can provide feedback by adding custom instructions whenever Assistant gives a suggested fix.
124143

125-
Memories are enabled by default for all Assistant users.
144+
Memories are enabled by default for all organizations with Assistant enabled.
126145

127-
To add a memory:
146+
### Add a memory based on Assistant's suggested fix
128147

129-
1. Identify the specific instance of **Assistant's suggested fix** that you want to modify. These can be found in the finding details page or in the PR or MR comment.
130-
2. Click **Customize fix** to open an input box, and enter your preferred remediation approaches and secure defaults for the project. The suggestion you provide can be as general as "Use AWS Secrets Manager to manage secrets."
148+
To add a memory modifying a suggested fix presented by Assistant:
149+
150+
1. Identify the specific instance of **Assistant's suggested fix** that you want to modify. These can be found on the finding details page or in the PR or MR comment.
151+
2. Click **Customize fix** to open an input box, and enter your preferred remediation approaches and secure defaults for the project. Your suggestion can be as general as "Use AWS Secrets Manager to manage secrets."
131152
![Assistant’s suggested fix for a hardcoded secret in the user’s code](/img/memories-3.png#md-width)
132153
***Figure***. Assistant’s suggested fix for a hardcoded secret in the user’s code.
133154
3. Click **Save and regenerate**.
@@ -139,6 +160,29 @@ To add a memory:
139160

140161
While Assistant Memories is in **public beta**, memories are scoped to remediation guidance on a per-project and per-rule basis. A saved memory only affects future guidance for findings triggered by the same rule in the same project.
141162

163+
### Add memory during triage
164+
165+
If you identify findings that are safe to ignore and write triage notes indicating why this is so, Assistant can store this information as a memory and use it when assessing whether a similar finding should be shown to developers in the future. Assistant also takes that memory, reanalyzes similar findings in your backlog, and suggests issues that may be safe to close.
166+
167+
To add a memory during triage:
168+
169+
1. Identify the specific finding you want to modify, and open up its finding details page.
170+
2. Change the status of the finding to **Ignored**, and optionally, select an **Ignore reason** and provide **Comments** on why you're changing the finding's status as **Ignored**.
171+
3. Click **Ignore & add memory**.
172+
4. In the **Create memory** dialog:
173+
1. In **Memory**, provide the organization-specific reason why the finding is a false positive. If you provided a comment when setting the status of the finding, Semgrep copies the comment into this field. Your suggestion can be as general as "When there's a function that sanitizes user input, SQL injection is mitigated and developers shouldn't see the finding." Note that Assistant may modify the Memory's text for clarity after you save your changes.
174+
2. Provide the **Projects** to which this memory should be applied.
175+
3. Provide the **Rules** to which this memory should be applied.
176+
4. Select the **Apply to <span className="placeholder">X</span> existing findings in scope** box if you would like Semgrep to apply this memory to any existing findings automatically.
177+
5. Click **Add memory** to save your changes.
178+
![User-provided instructions for generating a memory during the triage process.](/img/triage-memories.png#md-width)
179+
***Figure***. User-provided instructions for generating a memory during the triage process.
180+
181+
### View Memories
182+
183+
1. Sign in to [Semgrep AppSec Platform](https://semgrep.dev/login?return_path=/manage/projects) and navigate to [<i class="fa-solid fa-gear"></i> **Settings > Deployment**](https://semgrep.dev/orgs/-/settings).
184+
2. In the **Assistant** section, click the <i class="fa-solid fa-gear"></i> **icon** next to **Customize with memories**. This opens a list of your organization's Memories for review.
185+
142186
### Remove Memories
143187

144188
1. Sign in to [Semgrep AppSec Platform](https://semgrep.dev/login?return_path=/manage/projects) and navigate to [<i class="fa-solid fa-gear"></i> **Settings > Deployment**](https://semgrep.dev/orgs/-/settings).

docs/semgrep-assistant/metrics.md

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
slug: metrics
3+
title: Metrics and methodology
4+
hide_title: true
5+
description: Learn about Semgrep Assistant metrics and methodology.
6+
tags:
7+
- Deployment
8+
- Semgrep Assistant
9+
---
10+
11+
# Semgrep Assistant metrics and methodology
12+
13+
Semgrep's metrics for evaluating Semgrep Assistant's performance are derived from two sources:
14+
15+
- **User feedback** on Assistant recommendations within the product
16+
- **Internal triage and benchmarking** conducted by Semgreps security research team
17+
18+
This methodology ensures that Assistant is evaluated from both a user's and expert's perspective. This gives Semgrep's product and engineering teams a holistic view into Assistant's real-world performance.
19+
20+
## User feedback (real-world dataset)
21+
22+
User feedback shows the aggregated and anonymized performance of Assistant across **more than 1000 customers**, providing a comprehensive real-world dataset.
23+
24+
Users are prompted in-line to "thumbs up" or "thumbs down" Assistant suggestions as they receive Assistant suggestions in their PR or MR. This ensures that sampling bias is reduced, as both developers and AppSec engineers can provide feedback.
25+
26+
**Results as of Jan 10, 2024:**
27+
28+
<table>
29+
<tr>
30+
<td>Customers in dataset</td>
31+
<td><b>1000+</b></td>
32+
</tr>
33+
<tr>
34+
<td>Findings analyzed</td>
35+
<td><b>250,000+</b></td>
36+
</tr>
37+
<tr>
38+
<td>Human-agree rate</td>
39+
<td><b>92%</b></td>
40+
</tr>
41+
<tr>
42+
<td>Median time to resolution</td>
43+
<td><b>22% faster than baseline</b></td>
44+
</tr>
45+
<tr>
46+
<td>Average time saved per finding</td>
47+
<td><b>30 minutes</b></td>
48+
</tr>
49+
</table>
50+
51+
## Internal benchmarks
52+
53+
Internal benchmarks for Assistant use a process in which a rotating team of security engineers conduct periodic reviews of findings and their Assistant generated triage recommendations or remediation guidance. This is the same process used to evaluate Semgrep's SAST engine and rule performance.
54+
55+
Internal benchmarks for Assistant run on the same dataset used by Semgrep's security research team to analyze Semgrep rule performance. This means the dataset is not prone to cherry-picked findings that are easier for AI to analyze, and accurately represents real-world performance across a variety of contexts.
56+
57+
<table>
58+
<tr>
59+
<td>Findings analyzed</td>
60+
<td><b>2000+</b></td>
61+
</tr>
62+
<tr>
63+
<td>Average reduction in findings[^1]</td>
64+
<td><b>20%</b></td>
65+
</tr>
66+
<tr>
67+
<td>False positive confidence rate[^2]</td>
68+
<td><b>96%</b></td>
69+
</tr>
70+
<tr>
71+
<td>Remediation guidance confidence rate[^3]</td>
72+
<td><b>80%</b></td>
73+
</tr>
74+
</table>
75+
76+
[^1]:The average % of SAST findings that Assistant filters out as noise.
77+
78+
[^2]:False positive confidence rate measures how often Assistant is correct when it identifies a false positive. **A high confidence rate means users can trust when Assistant identifies a false positive - it does not mean that Assistant catches all false positives.**
79+
80+
[^3]:Remediation guidance is rated on a binary scale of "helpful" / "not helpful".

docs/semgrep-assistant/overview.md

+12-3
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,19 @@ Auto-triage recommendations are available in Semgrep AppSec Platform's **Finding
9191
![Semgrep Assistant in the filtered Findings page](/img/semgrep-assistant-autotriage-findings.png#md-width)
9292
_**Figure.** Semgrep Assistant auto-triage in the Findings page._
9393

94-
Assistant's suggestions to ignore findings are also surfaced in PR or MR comments, so developers can triage an issue without switching contexts, as well as being sent through Slack.
94+
Assistant's suggestions to ignore findings are also surfaced in PR or MR comments, so developers can triage an issue directly without leaving their PR or MR.
9595

96-
![Semgrep Assistant in a Slack notification](/img/semgrep-assistant-slack.png#md-width)
97-
_**Figure.** Semgrep Assistant auto-triage in a Slack notification._
96+
### Weekly priority emails
97+
98+
Semgrep sends weekly emails with information on Assistant's top three backlog tasks across all findings. Unlike other Assistant features, these suggestions can include information for all Semgrep products that you have enabled. The emails are sent out on Monday to all organization admins.
99+
100+
### Noise filtering (beta)
101+
102+
Noise filtering increases developer velocity by reducing interruptions from potential false positives. With Noise Filtering, Assistant evaluates each finding to determine if it's a true positive using additional context. If Assistant thinks a finding may be a false positive, it prevents a PR comment from being posted in the developer workflow.
103+
104+
Security teams can review filtered findings at any time on Semgrep's [**Code > Pre-production** page](https://semgrep.dev/orgs/-/findings?tab=open&last_opened=All+time&backlog=preprod). Semgrep also allows you to agree or disagree with the filtering. If you agree with the suggestion, Semgrep closes the finding, but if you disagree, Semgrep reopens the finding.
105+
106+
Assistant is [over 95% accurate in categorizing Semgrep Code findings as false positives](/semgrep-assistant/metrics.md).
98107

99108
### Memories (beta)
100109

0 commit comments

Comments
 (0)