Skip to content

Commit fe1e276

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent f9d3505 commit fe1e276

File tree

9 files changed

+237
-5
lines changed

9 files changed

+237
-5
lines changed

doc/development/sec/cyclonedx_property_taxonomy.md

+6
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ The `Property of` column describes what object a property may be attached to.
7878
| ------------------------------------------ | ----------- | -------------- | ----------- |
7979
| `gitlab:dependency_scanning:language:name` | The name of the programming language associated with the dependency | `JavaScript`, `Ruby`, `Go` | `metadata`, `component` |
8080

81+
## `gitlab:dependency_scanning_component` namespace taxonomy
82+
83+
| Property | Description | Example values | Property of |
84+
| ------------------------------------------ | ----------- | -------------- | ----------- |
85+
| `gitlab:dependency_scanning_component:reachability` | Identifies if a component is used | `in_use`, `not_found` | `component` |
86+
8187
## `gitlab:container_scanning` namespace taxonomy
8288

8389
### Namespaces
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
---
2+
stage: Application Security Testing
3+
group: Composition Analysis
4+
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
5+
title: Static reachability analysis
6+
---
7+
8+
{{< details >}}
9+
10+
- Tier: Ultimate
11+
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
12+
- Status: Beta
13+
14+
{{< /details >}}
15+
16+
{{< history >}}
17+
18+
- [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/14177) as an [experiment](../../../policy/development_stages_support.md) in GitLab 17.5.
19+
- [Changed](https://gitlab.com/groups/gitlab-org/-/epics/15781) from experiment to beta in GitLab 17.11.
20+
21+
{{< /history >}}
22+
23+
Static reachability analysis (SRA) helps you prioritize remediation of vulnerabilities in dependencies.
24+
25+
An application is generally deployed with many dependencies. Dependency scanning identifies which of
26+
those dependencies have vulnerabilities. However, not all dependencies are used by an application.
27+
Static reachability analysis identifies those dependencies that are used, in other words reachable,
28+
and so are a higher security risk than others. Use this information to help prioritize remediation
29+
of vulnerabilities according to risk.
30+
31+
To identify vulnerable dependencies that are reachable, either:
32+
33+
- Hover over the **Severity** value of a vulnerability in the vulnerability report.
34+
- Check the `Reachable` value in the vulnerability page.
35+
- Use a GraphQL query to list those vulnerabilities that are reachable.
36+
37+
## Supported languages and package managers
38+
39+
Static reachability analysis is available only for Python projects. SRA uses the new dependency
40+
scanning analyzer to generate SBOMs and so supports the same package managers as the analyzer.
41+
42+
| Language | Supported Package Managers |
43+
|----------|----------------------------|
44+
| Python | `pip`, `pipenv`, `poetry`, `uv` |
45+
46+
## Enable static reachability analysis
47+
48+
Enable static reachability analysis to identify high-risk dependencies.
49+
50+
Prerequisites:
51+
52+
- Enable [Dependency Scanning by using SBOM](dependency_scanning_sbom/_index.md#configuration).
53+
54+
Make sure you follow the [pip](dependency_scanning_sbom/_index.md#pip) or [pipenv](dependency_scanning_sbom/_index.md#pipenv)
55+
related instructions for dependency scanning using SBOM. You can also use any other Python package manager that is [supported](https://gitlab.com/gitlab-org/security-products/analyzers/dependency-scanning#supported-files) by the DS analyzer.
56+
57+
To enable static reachability analysis:
58+
59+
- Edit the project `.gitlab-ci.yml` file and set `DS_STATIC_REACHABILITY_ENABLED` to `true`.
60+
61+
Enabling static reachability:
62+
63+
```yaml
64+
stages:
65+
- build
66+
- test
67+
68+
include:
69+
- template: Jobs/Dependency-Scanning.latest.gitlab-ci.yml
70+
71+
variables:
72+
DS_STATIC_REACHABILITY_ENABLED: true
73+
DS_ENFORCE_NEW_ANALYZER: true
74+
75+
# Build job required by the DS analyzer to create pipdeptree.json
76+
# https://docs.gitlab.com/user/application_security/dependency_scanning/dependency_scanning_sbom/#pip
77+
build:
78+
stage: build
79+
image: "python:latest"
80+
script:
81+
- "pip install -r requirements.txt"
82+
- "pip install pipdeptree"
83+
- "pipdeptree --json > pipdeptree.json"
84+
artifacts:
85+
when: on_success
86+
access: developer
87+
paths: ["**/pipdeptree.json"]
88+
```
89+
90+
The dependency scanning analyzer requires specific lock files to function properly. These files must
91+
be generated during a build job on a stage prior to dependency scanning. By default, the dependency
92+
scanning with reachability job is configured to depend on a job named `build`. If you need to use a
93+
different name for your build job, you must override the dependency scanning `needs` section in your
94+
configuration. Below is an example using `pip-compile` to generate a requirement lock file. This
95+
file is passed to the new DS analyzer by using the `DS_PIPCOMPILE_REQUIREMENTS_FILE_NAME_PATTERN`
96+
because the name is not standard.
97+
98+
```yaml
99+
stages:
100+
- build
101+
- test
102+
103+
include:
104+
- template: Jobs/Dependency-Scanning.latest.gitlab-ci.yml
105+
106+
variables:
107+
DS_ENFORCE_NEW_ANALYZER: true
108+
DS_STATIC_REACHABILITY_ENABLED: true
109+
DS_PIPCOMPILE_REQUIREMENTS_FILE_NAME_PATTERN: "requirements-lock.txt"
110+
111+
create:
112+
stage: build
113+
image: "python:3.12"
114+
script:
115+
- pip install pip-tools
116+
- pip-compile requirements.txt -o requirements-lock.txt
117+
artifacts:
118+
when: on_success
119+
access: developer
120+
paths: ["**/requirements-lock.txt"]
121+
122+
dependency-scanning-with-reachability:
123+
needs:
124+
- job: gitlab-static-reachability
125+
optional: true
126+
artifacts: true
127+
# For supporting Scan Execution Policies.
128+
- job: gitlab-static-reachability-0
129+
optional: true
130+
artifacts: true
131+
- job: create # Instead of depending on build job it depends on `create` job
132+
optional: true
133+
artifacts: true
134+
```
135+
136+
Static reachability introduces two key jobs:
137+
138+
- `gitlab-static-reachability`: Performs Static Reachability Analysis (SRA) on your Python files.
139+
- `dependency-scanning-with-reachability`: Executes dependency scanning and generates an SBOM report enriched with reachability data. This job requires the artifact output from the `gitlab-static-reachability` job.
140+
141+
{{< alert type="note" >}}
142+
143+
When you enable static reachability feature for non-Python projects, the
144+
`gitlab-static-reachability` job will fail but won't break your pipeline, because it's configured to
145+
allow failures. In such cases, the `dependency-scanning-with-reachability` job will perform standard
146+
dependency scanning without adding reachability data to the SBOM.
147+
148+
{{< /alert >}}
149+
150+
Static reachability analysis functionality is supported in [Dependency Scanning analyzer](https://gitlab.com/gitlab-org/security-products/analyzers/dependency-scanning) version `0.23.0` and all subsequent versions.
151+
152+
{{< alert type="warning" >}}
153+
154+
Changes to the CI/CD configuration for static reachability integration are proposed for the GA release.
155+
156+
{{< /alert >}}
157+
158+
## How static reachability analysis works
159+
160+
Static reachability analysis requires two key components:
161+
162+
- Dependency scanning (DS): Generates an SBOM report that identifies all components and their transitive dependencies.
163+
- GitLab Advanced SAST (GLAS): Performs static reachability analysis to provide a report showing direct dependencies usage in the codebase.
164+
165+
Static reachability analysis adds reachability data to the SBOM output by dependency scanning. The enriched SBOM is then ingested by the GitLab instance.
166+
167+
Reachability data in the UI can have one of the following values:
168+
169+
| Reachability values | Description |
170+
|---------------------|---------------------------------------------------------------------------|
171+
| Yes | The package linked to this vulnerability is confirmed reachable in code |
172+
| Not Found | SRA ran successfully but did not detect usage of the vulnerable package |
173+
| Not Available | SRA was not executed, therefore no reachability data exists |
174+
175+
## Where to find the reachability data
176+
177+
The reachability data is available in the vulnerability report
178+
179+
![Reachability on the vulnerability report](img/sr_vulnerability_report_v17_11.png)
180+
181+
and the vulnerability page
182+
183+
![Reachability on the vulnerability page](img/sr_vulnerability_page_v17_11.png)
184+
185+
Finally reachability data can be reached using GraphQL.
186+
187+
{{< alert type="warning" >}}
188+
189+
When a vulnerability reachability value shows as "Not Found," exercise caution rather than completely dismissing it, because the beta version of SRA may produce false negatives.
190+
191+
{{< /alert >}}
192+
193+
## Restrictions
194+
195+
Static reachability analysis has the following limitations:
196+
197+
- Offline GitLab instances are not supported, though this is proposed for the GA release.
198+
- When a direct dependency is marked as `in use`, all its transitive dependencies are also marked as `in use`.
199+
- Requires the new [dependency scanning analyzer](https://gitlab.com/gitlab-org/security-products/analyzers/dependency-scanning). [Gemnasium](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium) analyzers are not supported.
200+
- SRA on beta doesn't officially support pipeline execution policies.
201+
- SRA on beta works with scan execution policies (SEP), but with the following restrictions:
202+
- only dependency scanning and/or static reachability jobs should be added through SEP. You should avoid having a policy while also including the latest dependency scanning template in your project configuration.
203+
- Users cannot override the build job name that `dependency-scanning-with-reachability` depends on. Consequently if a build job is required to create a lock file for the dependency scanning analyzer then the name must be named `build`.

doc/user/application_security/terminology/_index.md

+4
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,10 @@ An example primary identifier is `CVE`, which is used for Trivy. The identifier
273273
Subsequent scans must return the same value for the same finding, even if the location has slightly
274274
changed.
275275

276+
## Reachability
277+
278+
Reachability indicates whether a [component](#component) listed as a dependency in a project is actually used in the codebase.
279+
276280
## Report finding
277281

278282
A [finding](#finding) that only exists in a report produced by an analyzer, and is yet to be

doc/user/application_security/vulnerabilities/_index.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ For vulnerabilities in the [Common Vulnerabilities and Exposures (CVE)](https://
2828
catalog, these details also include:
2929

3030
- CVSS score
31-
- [EPSS score](risk_assessment_data.md#epss)
32-
- [KEV status](risk_assessment_data.md#kev)
31+
- EPSS score
32+
- KEV status
33+
- [Reachability status](../dependency_scanning/static_reachability.md) (Beta)
3334

3435
For further details on this additional data, see [vulnerability risk assessment data](risk_assessment_data.md).
3536

doc/user/application_security/vulnerabilities/risk_assessment_data.md

+15
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@ The KEV catalog lists vulnerabilities that are known to have been exploited. You
4444
the remediation of vulnerabilities in the KEV catalog above other vulnerabilities. Attacks using
4545
these vulnerabilities have occurred and the exploitation method is likely known to attackers.
4646

47+
## Reachability
48+
49+
{{< history >}}
50+
51+
- [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/16510) in GitLab 17.11.
52+
53+
{{< /history >}}
54+
55+
Reachability shows whether a vulnerable package is actively used in your application.
56+
Vulnerabilities in packages that your code directly interacts with pose a higher risk than those in unused dependencies.
57+
Prioritize fixing reachable vulnerabilities, as they represent real exposure points that attackers could exploit.
58+
4759
## Query risk assessment data
4860

4961
Use the GraphQL API to query the severity, EPSS, and KEV values of vulnerabilities in a project.
@@ -72,6 +84,7 @@ client.
7284
isKnownExploit
7385
cve
7486
}
87+
reachability
7588
}
7689
}
7790
}
@@ -99,6 +112,7 @@ Example output:
99112
"isKnownExploit": false,
100113
"cve": "CVE-2019-3859"
101114
}
115+
"reachability": "UNKNOWN"
102116
},
103117
{
104118
"severity": "CRITICAL",
@@ -113,6 +127,7 @@ Example output:
113127
"isKnownExploit": true,
114128
"cve": "CVE-2016-8735"
115129
}
130+
"reachability": "IN_USE"
116131
},
117132
]
118133
}

doc/user/application_security/vulnerability_report/_index.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ For projects and groups, the vulnerability report contains:
5656
- Filters for common vulnerability attributes.
5757
- Details of each vulnerability, presented in a table.
5858

59-
For some vulnerabilities, the details include a link to the relevant file and line number in the default branch. For CVE vulnerabilities, you can also view the KEV status and the CVSS and EPSS scores in the vulnerability report. For more details on the security scores, see [vulnerability risk assessment data](../vulnerabilities/risk_assessment_data.md).
59+
For some vulnerabilities, the details include a link to the relevant file and line number in the
60+
default branch. For CVE vulnerabilities, you can also view the KEV status, CVSS and EPSS scores,
61+
and reachability information (Beta) in the vulnerability report. For more details on the security
62+
scores, see [vulnerability risk assessment data](../vulnerabilities/risk_assessment_data.md).
6063

6164
For projects, the vulnerability report also contains:
6265

spec/graphql/resolvers/work_items_resolver_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
end
134134

135135
it 'batches queries that only include IIDs', :request_store do
136-
result = batch_sync(max_queries: 11) do
136+
result = batch_sync(max_queries: 15) do
137137
[item1, item2]
138138
.map { |item| resolve_items(iid: item.iid.to_s) }
139139
.flat_map(&:to_a)
@@ -143,7 +143,7 @@
143143
end
144144

145145
it 'finds a specific item with iids', :request_store do
146-
result = batch_sync(max_queries: 11) do
146+
result = batch_sync(max_queries: 15) do
147147
resolve_items(iids: [item1.iid]).to_a
148148
end
149149

0 commit comments

Comments
 (0)