Skip to content

Commit 6457f30

Browse files
s-santillankhorne3
andauthored
Sara/tec 304 new conditions for ssc policies for ga (#2000)
* initial commit for GA ssc policies * update with various components, new screenshots, updated behavior text * wording change, links, change sidebar order * remove old instructions about setting up ssc comments * nicer instructions * remove extraneous portions * update with link * add tidbit about supply chain * add supply chain addendum for now * change box to info * address review notes * Update docs/semgrep-supply-chain/getting-started.md Co-authored-by: Katie Horne <[email protected]> * update based on emma feedback * address review notes and add icons * style guide * review --------- Co-authored-by: Katie Horne <[email protected]>
1 parent f487cc2 commit 6457f30

21 files changed

+124
-103
lines changed

docs/semgrep-appsec-platform/azure-pr-comments.md

+9-10
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ tags:
1313
import DeploymentJourney from "/src/components/concept/_deployment-journey.mdx"
1414
import CommentTriggers from "/src/components/reference/_comment-triggers.mdx"
1515
import PrCommentsInSast from "/src/components/procedure/_pr-comments-in-sast.mdx"
16-
import DisableComments from "/src/components/procedure/_disable_ssc_pr_mr_comments.mdx"
1716
import TroubleshootingPrLinks from "/src/components/reference/_troubleshooting-pr-links.mdx"
1817
import NextAfterComments from "/src/components/procedure/_next-after-comments.mdx"
18+
import CommentsInSupplyChain from "/src/components/concept/_comments-in-supply-chain.md"
1919

2020
<!-- vale on -->
2121

@@ -51,13 +51,7 @@ PR comments are enabled by default for users who have connected their Azure DevO
5151
1. In your Semgrep AppSec Platform account, click **Settings > Source code managers**.
5252
2. Check that an entry for your Azure DevOps org exists and is correct.
5353

54-
### Configure comments for Semgrep Code
55-
56-
<PrCommentsInSast name="Azure" comment_type="PR" />
57-
58-
:::info
59-
Only rules set to the **Comment** and **Block** rule modes in the [Policies page](https://semgrep.dev/orgs/-/policies) create PR comments.
60-
:::
54+
### Set up the configuration file
6155

6256
In the Azure Pipelines configuration file, export the `SEMGREP_REPO_URL` and `SEMGREP_REPO_NAME` variables to enable PR comments and ensure that findings and related data are accurately labeled with your project's information. Note that the namespace that's a part of the variable's value follows the format `{organization}/{project}`:
6357

@@ -106,9 +100,14 @@ steps:
106100
```
107101
</details>
108102
109-
## Disable PR comments for Supply Chain findings
103+
### Configure comments for Semgrep Code
104+
105+
<PrCommentsInSast name="Azure" comment_type="PR" />
106+
107+
108+
### Configure comments for Semgrep Supply Chain
110109
111-
<DisableComments />
110+
<CommentsInSupplyChain />
112111
113112
## Next steps
114113

docs/semgrep-appsec-platform/bitbucket-cloud-pr-comments.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import NextAfterComments from "/src/components/procedure/_next-after-comments.md
1919
import CommentTriggers from "/src/components/reference/_comment-triggers.mdx"
2020
import ReceiveCommentsScm from "/src/components/procedure/_receive-comments-scm.mdx"
2121
import PrCommentsInSast from "/src/components/procedure/_pr-comments-in-sast.mdx"
22-
import DisableComments from "/src/components/procedure/_disable_ssc_pr_mr_comments.mdx"
22+
import CommentsInSupplyChain from "/src/components/concept/_comments-in-supply-chain.md"
2323

2424
<!-- vale on -->
2525

@@ -185,6 +185,10 @@ pipelines:
185185
186186
<PrCommentsInSast name="Bitbucket" comment_type="PR" />
187187
188+
### Configure comments for Semgrep Supply Chain
189+
190+
<CommentsInSupplyChain />
191+
188192
### Receive comments in your VPN or on-premise SCM
189193
190194
Bitbucket Premium provides [<i class="fas fa-external-link fa-xs"></i> access control features](https://support.atlassian.com/bitbucket-cloud/docs/control-access-to-your-private-content/) for content that your individual account owns. If you use this feature, you need to add several IP addresses into your allowlist.
@@ -195,10 +199,6 @@ Bitbucket Premium provides [<i class="fas fa-external-link fa-xs"></i> access co
195199
Only rules set to the **Comment** and **Block** rule modes in the [Policies page](https://semgrep.dev/orgs/-/policies) create PR comments.
196200
:::
197201
198-
## Disable PR comments for Supply Chain findings
199-
200-
<DisableComments />
201-
202202
## Next steps
203203
204204
<NextAfterComments />

docs/semgrep-appsec-platform/bitbucket-data-center-pr-comments.md

+3-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import NextAfterComments from "/src/components/procedure/_next-after-comments.md
1919
import CommentTriggers from "/src/components/reference/_comment-triggers.mdx"
2020
import ReceiveCommentsScm from "/src/components/procedure/_receive-comments-scm.mdx"
2121
import PrCommentsInSast from "/src/components/procedure/_pr-comments-in-sast.mdx"
22-
import DisableComments from "/src/components/procedure/_disable_ssc_pr_mr_comments.mdx"
22+
import CommentsInSupplyChain from "/src/components/concept/_comments-in-supply-chain.md"
2323

2424
<!-- vale on -->
2525

@@ -59,13 +59,9 @@ Confirm that you have the correct connection and access:
5959

6060
<PrCommentsInSast name="Bitbucket" comment_type="PR" />
6161

62-
:::info
63-
Only rules set to the **Comment** and **Block** rule modes in the [Policies page](https://semgrep.dev/orgs/-/policies) create PR comments.
64-
:::
62+
### Configure comments for Semgrep Supply Chain
6563

66-
## Disable PR comments for Supply Chain findings
67-
68-
<DisableComments />
64+
<CommentsInSupplyChain />
6965

7066
## Next steps
7167

docs/semgrep-appsec-platform/github-pr-comments.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import PrCommentsInSast from "/src/components/procedure/_pr-comments-in-sast.mdx
2020
import DefineConnectionVariables from "/src/components/reference/_define-connection-variables.mdx"
2121
import ReceiveCommentsScm from "/src/components/procedure/_receive-comments-scm.mdx"
2222
import NextAfterComments from "/src/components/procedure/_next-after-comments.mdx"
23-
import DisableComments from "/src/components/procedure/_disable_ssc_pr_mr_comments.mdx"
23+
import CommentsInSupplyChain from "/src/components/concept/_comments-in-supply-chain.md"
2424

2525
<!-- vale on -->
2626

@@ -71,7 +71,7 @@ _**Figure**. Permissions for all repositories._
7171
![Semgrep GitHub app permissions - select repositories](/img/gh-app-permissions-select.png)
7272
_**Figure**. Permissions for select repositories. Ensure the repositories you have onboarded to Semgrep AppSec Platform are selected._
7373

74-
For GitHub Actions users, no further steps need to be undertaken. Continue setting up Semgrep Code PR comments by [setting rules to Comment or Block mode](#set-rules-to-comment-or-block-mode).
74+
For GitHub Actions users, no further steps need to be undertaken. Continue setting up PR comments by configuring comments for Semgrep Code.
7575

7676
### Required environment variables
7777

@@ -83,6 +83,10 @@ For GitHub Actions users, no further steps need to be undertaken. Continue setti
8383

8484
If you are using **GitHub Actions** to run Semgrep, no extra changes are needed to receive PR comments.
8585

86+
### Configure comments for Semgrep Supply Chain
87+
88+
<CommentsInSupplyChain />
89+
8690
### Receive comments in your VPN or on-premise SCM
8791

8892
<ReceiveCommentsScm />
@@ -130,10 +134,6 @@ Both GitHub and GitLab provide features to prevent or block a PR or MR from merg
130134
</tr>
131135
</table>
132136

133-
## Disable PR comments for Supply Chain findings
134-
135-
<DisableComments />
136-
137137
## Next steps
138138

139139
<NextAfterComments />

docs/semgrep-appsec-platform/gitlab-mr-comments.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import DefineConnectionVariables from "/src/components/reference/_define-connect
2121
import DeploymentJourney from "/src/components/concept/_deployment-journey.mdx"
2222
import ReceiveCommentsScm from "/src/components/procedure/_receive-comments-scm.mdx"
2323
import NextAfterComments from "/src/components/procedure/_next-after-comments.mdx"
24-
import DisableComments from "/src/components/procedure/_disable_ssc_pr_mr_comments.mdx"
24+
import CommentsInSupplyChain from "/src/components/concept/_comments-in-supply-chain.md"
2525

2626
<!-- vale on -->
2727

@@ -121,6 +121,10 @@ If you're using Semgrep with multiple GitLab groups, ensure that you've complete
121121

122122
<PrCommentsInSast name="GitLab" comment_type="MR" />
123123

124+
### Configure comments for Semgrep Supply Chain
125+
126+
<CommentsInSupplyChain />
127+
124128
### Receive comments in your VPN or on-premise SCM
125129

126130
:::info
@@ -156,10 +160,6 @@ To enable dataflow traces in your CI pipeline, fulfill the following prerequisit
156160
- Not all Semgrep rules or rulesets make use of taint tracking. Ensure that you have a ruleset, such as the **default ruleset** added in your **[Policies](https://semgrep.dev/orgs/-/policies)**. If this ruleset is not added, go to [https://semgrep.dev/p/default](https://semgrep.dev/p/default), and then click **Add to Policy**. You can add rules that use taint tracking from [Semgrep Registry](https://semgrep.dev/explore).
157161
:::
158162

159-
## Disable MR comments for Supply Chain findings
160-
161-
<DisableComments />
162-
163163
## Next steps
164164

165165
<NextAfterComments />

docs/semgrep-appsec-platform/tags.md

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ tags:
1111

1212
# Tag projects
1313

14+
Tagging enables you to group projects together based on your organization's unique business structure or needs. By tagging projects, you are able to quickly apply Supply Chain policies and other Semgrep features to specific groups.
15+
1416
Add tags for specific projects in the Semgrep AppSec Platform through the following methods:
1517

1618
* Set tags through the **Semgrep AppSec Platform > Projects > Project details** page.

docs/semgrep-supply-chain/getting-started.md

+1-19
Original file line numberDiff line numberDiff line change
@@ -136,22 +136,4 @@ Semgrep Supply Chain supports the scanning of monorepos. As outlined in [Project
136136

137137
## Block pull or merge requests
138138

139-
Semgrep can help block pull requests (PRs) or merge requests (MRs) when it matches a blocking finding. When one or more findings is blocking, Semgrep returns exit code `1`, and you can use this result to set up additional checks to enforce a block in your CI/CD pipeline, such as not allowing merge of the PR/MR. This action applies to full and [diff-aware scans](/semgrep-code/glossary#diff-aware-scan).
140-
141-
You can configure Semgrep Supply Chain to help block scans whenever all of the following conditions are met:
142-
143-
* It detects reachable findings in direct dependencies
144-
* The reachable findings are of critical or high severity
145-
* There is an upgrade available for the affected dependency; this is to prevent blocking when there is no resolution for the vulnerability
146-
147-
To enable **Scan Blocking**:
148-
149-
1. Sign in to Semgrep AppSec Platform.
150-
2. Go to **Settings > Deployment** and navigate to the **Supply Chain (SCA)** section.
151-
3. Click **<i class="fa-solid fa-toggle-large-on"></i> Scan Blocking**.
152-
153-
Alternatively, you can configure your version control system to prevent merging if Semgrep Supply Chain identifies reachable findings.
154-
155-
:::tip
156-
Policies for Semgrep Supply Chain is now in private beta. See [Manage policies](/semgrep-supply-chain/policies) for more information.
157-
:::
139+
You can comment on or potentially block pull or merge requests by defining a [Supply Chain Policy](/semgrep-supply-chain/policies).

docs/semgrep-supply-chain/glossary.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ title: Supply Chain glossary
88
hide_title: true
99
---
1010

11+
import TransitivityTypes from "/src/components/concept/_transitivity-types.md"
12+
import EpssTypes from "/src/components/concept/_epss-types.md"
1113
import DefReachability from "/src/components/concept/_def-reachability.md"
1214

1315
# Semgrep Supply Chain glossary
@@ -26,6 +28,10 @@ Publicly available code used as a part of your application. Common examples incl
2628

2729
Exploitability is the practical assessment of a vulnerability's threat, typically proved with a real proof of exploit. Proving exploitability is often the last step of triaging a vulnerability.
2830

31+
## EPSS probability
32+
33+
<EpssTypes />
34+
2935
## Lockfile
3036

3137
A lockfile describes a dependency tree to ensure that deployments and organizations install the same **dependencies and exact versions** for their codebase. Lockfile information includes versions of the dependency and any transitive (indirect) dependencies. Lockfiles are automatically generated by a package manager such as `pip` or `npm`.
@@ -54,7 +60,7 @@ A package registry stores dependencies and provides a means to upload or downloa
5460

5561
## Reachable finding (and reachable vulnerability)
5662

57-
A reachable finding means that you are using both a vulnerable piece of code (the **usage**) and the vulnerable version of a dependency. Within Semgrep Supply Chain, specific findings (usages) are grouped together by their vulnerability.
63+
A reachable finding means that you are using both a vulnerable code pattern (the **usage**) and the vulnerable version of a dependency. Within Semgrep Supply Chain, specific findings (usages) are grouped together by their vulnerability.
5864

5965
Continuous integration scans with Semgrep Supply Chain rules can block pull or merge requests upon detecting any reachable findings.
6066

@@ -66,7 +72,7 @@ See also [Reachability](#reachability).
6672

6773
## Reachability rules
6874

69-
A type of Semgrep Supply Chain rule that performs reachability analysis. A reachability rule can determine if the vulnerable piece of code from a dependency is used in the codebase that imports it.
75+
A type of Semgrep Supply Chain rule that performs reachability analysis. A reachability rule can determine if the vulnerable code pattern from a dependency is used in the codebase that imports it.
7076

7177
Compare its opposite: [rules without reachability analysis](#rules-without-reachability-analysis)
7278

@@ -88,6 +94,12 @@ A transitive or indirect dependency is a dependency of a dependency. If your cod
8894

8995
For more information, see [Supported languages](/docs/supported-languages#semgrep-supply-chain).
9096

97+
## Transitivity
98+
99+
Pertains to a dependency's relationship to your codebase or first-party code.
100+
101+
<TransitivityTypes />
102+
91103
## Usage
92104

93105
In Semgrep Supply Chain scans, a **usage **is a specific finding in your codebase where Semgrep has found a vulnerability. A vulnerability may have more than one usage, such as when a library is imported and used in many code files.

docs/semgrep-supply-chain/policies.md

+43-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ tags:
1212

1313
By default, Semgrep AppSec Platform collects Supply Chain findings without notifying developers, similar to the [**Monitor** mode](/semgrep-code/policies#block-a-pr-or-mr-through-rule-modes) in Semgrep Code. This prevents developers from receiving notifications while you evaluate the tool.
1414

15-
Once you are ready to to notify developers through a **comment**, or potentially **block** them from merging a pull or merge request (PR or MR), define a **Supply Chain policy**. This feature helps you manage noise and ensures that developers are only notified or potentially blocked based on the conditions you set.
15+
Once you are ready to notify developers through a **comment**, or potentially **block** them from merging a pull or merge request (PR or MR), define a **Supply Chain policy**. This feature helps you manage noise and ensures that developers are only notified or potentially blocked based on the conditions you set.
1616

1717
This feature enables you to configure the following:
1818

@@ -32,20 +32,52 @@ Only **admins** can view, create, edit, or delete policies.
3232

3333
1. Sign in to [<i class="fas fa-external-link fa-xs"></i> Semgrep AppSec Platform](https://semgrep.dev/login).
3434
1. From the navigation menu, click **Rules** to expand the drop-down box, then click **Policies**.
35-
1. Click **Supply Chain**. This takes you to the Supply Chain policies tab.
35+
1. Click **Supply Chain**. This takes you to the Supply Chain policies tab. Your policies are arranged as cards.
36+
![Policies > Semgrep Supply Chain](/img/ssc-policies-card.png#md-width)
37+
_**Figure**. A single card within the Semgrep Supply Chain Policies page._
38+
39+
- To view and edit an existing policy, click its **name** or **the three-dot ellipsis (<i class="fas fa-ellipsis-h"></i>) > Edit policy**.
40+
- View a popup of a policy's **scope** (affected projects or tags) or a summary of its **actions and conditions** by clicking on the two summary links beside the policy name.
3641

3742
## Create a policy
3843

39-
1. From the Supply Chain policies tab, Click **Create policy**.
44+
1. From the Supply Chain policies tab, Click **<i class="fa-solid fa-plus"></i> Create policy**.
4045
1. Provide a **Policy name**.
4146
1. Define the scope of the policy:
42-
1. Click the drop-down box to select between **All Projects**, **Project**, or **Project tag**.
47+
1. Click the drop-down box to select between **All Projects**, **Project**, or **Project tag**. Note that you can only select either a scope based on projects or tags, but not both.
4348
1. For **Project** or **Project tag** values, a second drop-down box appears. Choose the **projects** or **project tags** to finish defining the scope.
44-
1. Define the conditions of the policy by selecting either **Reachable** or **Critical or high severity, reachable, upgrades available**. Selecting **Reachable** typically results in more findings shown to developers.
49+
1. Define the conditions of the policy. See the [Policy conditions](#policy-conditions) section for more information. You can create more than one condition by clicking **Add condition**.
50+
- For each condition, you can select multiple values by clicking on the **plus sign (<i class="fa-solid fa-plus"></i>)** on the same row. The policy is applied when **any** of those values are met (`OR`).
51+
- Each additional condition is additive. The policy is applied when **all** conditions are met (`AND`).
52+
![Policies > Semgrep Supply Chain](/img/ssc-policies-many-conditions.png)
4553
1. Define the actions of the policy. You can choose to **Leave a comment** or **Block and leave a comment**.
4654
1. Click **Save**. This brings you back to the Supply Chain policies tab.
55+
1. After creating a policy, it is **not** automatically enabled. Click the **<i class="fa-solid fa-toggle-large-on"></i> toggle** to enable a policy. This applies the policy to future scans.
56+
57+
## Common use cases for policies
58+
59+
- Blocking reachable findings with upgradeable dependencies. This is a reasonable policy as it provides a path to unblock the user, as Semgrep can leave a comment with the upgrade instructions.
60+
- Leaving a comment for:
61+
- Reachable findings without upgradeable dependencies, to make the developer aware of the risk.
62+
- Reachable, yet transitive findings; depending on your organization's policies, these may need to be flagged for risk.
63+
64+
## Policy scopes
65+
66+
A policy's scope can consist of tags or projects, but not both. If you need to create a policy with both tags and projects, simply make another policy.
4767

48-
After creating a policy, it is automatically **enabled** and will be applied to subsequent scans.
68+
If a project or project tag that's included in a policy scope gets deleted, it is **removed from the policy scope**. If all projects or all project tags are deleted for a given policy, you must edit the policy for it to be applied to a valid scope.
69+
70+
## Policy conditions
71+
72+
The following table lists available conditions and their values:
73+
74+
| Condition | Values|
75+
| ------- | ------ |
76+
| [Reachability](/semgrep-supply-chain/glossary#reachability) | <ul><li>Always reachable</li><li>Reachable</li><li>Conditionally reachable</li> <li>Unreachable</li> </ul> |
77+
| Severity | <ul><li>Critical</li><li>High</li><li>Medium</li><li>Low</li> </ul> |
78+
| Upgrade availability | <ul> <li>Upgrade available</li> <li>Upgrade unavailable</li> </ul> |
79+
| [Transitivity](/semgrep-supply-chain/glossary#transitivity) | <ul><li>Direct</li> <li>Transitive</li></ul> |
80+
| [EPSS probability](/semgrep-supply-chain/glossary#epss-probability) | <ul> <li>High</li><li>Medium</li><li>Low</li><li>None</li> </ul> |
4981

5082
## Other operations
5183

@@ -68,3 +100,8 @@ You can also disable or enable a policy from the policy's page:
68100
### Delete a policy
69101

70102
From the Supply Chain policies tab, click the **three dot (...) button > Delete policy**, then click **Remove**.
103+
104+
Note that:
105+
106+
- This does not remove comments from existing PRs or MRs with findings.
107+
- If a policy is the **sole culprit** for blocking a PR, deleting it **and** re-running a scan unblocks the PR or MR.

docs/semgrep-supply-chain/triage-remediation.md

+1-15
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,4 @@ The **Vulnerabilities** tab allows you to identify the reachable, true positives
8484

8585
## Block pull or merge requests
8686

87-
Semgrep can help block pull requests (PRs) or merge requests (MRs) when it matches a blocking finding. When one or more findings is blocking, Semgrep returns exit code `1`, and you can use this result to set up additional checks to enforce a block in your CI/CD pipeline, such as not allowing merge of the PR/MR. This action applies to full and [diff-aware scans](/semgrep-code/glossary#diff-aware-scan).
88-
89-
Semgrep Supply Chain versions **v0.122.0** and earlier automatically aided in blocking pull or merge requests if it discovered reachable findings in the code, but later versions do not do this. You can, however, configure Semgrep Supply Chain to help block scans whenever all of the following conditions are met:
90-
91-
* It detects reachable findings in direct dependencies
92-
* The reachable findings are of critical or high severity
93-
* There is an upgrade available for the affected dependency; this is to prevent blocking when there is no resolution for the vulnerability
94-
95-
To enable **Scan Blocking**:
96-
97-
1. Sign in to Semgrep AppSec Platform.
98-
2. Go to **Settings > Deployment** and navigate to the **Supply Chain (SCA)** section.
99-
3. Click **<i class="fa-solid fa-toggle-large-on"></i> Scan Blocking**.
100-
101-
Alternatively, you can configure your version control system to prevent merging if Semgrep Supply Chain identifies reachable findings.
87+
To block or leave comments on pull or merge requests, see the [Supply Chain Policies](/semgrep-supply-chain/policies) document.

0 commit comments

Comments
 (0)