@@ -21,6 +21,7 @@ tracked separately from the library itself. These can be classified as:
21
21
control over the versions of system dependencies that the user might
22
22
provide to us.
23
23
24
+ .. _snyk : https://app.snyk.io
24
25
25
26
The Software Bill of Materials (SBOM)
26
27
*************************************
@@ -95,14 +96,214 @@ process, as this is primarily a release artifact for end users.
95
96
96
97
The augmented SBOM contains extra data about the dependencies from the
97
98
`SBOM-lite <sbom-lite> `, including vulnerabilities known at the time of the
98
- augmented SBOM's generation.
99
+ augmented SBOM's generation. [ #asbom-vulns ]_
99
100
100
101
The augmented SBOM is produced automatically and asynchronously as part of an
101
102
external process that is not contained within the repository itself. The
102
103
augmented SBOM is downloaded from an internal service using the `+sbom-download `
103
104
Earthly target, which is automatically included in the release archive for the
104
105
`+release-archive ` target.
105
106
107
+ .. _silk-asset-group :
108
+
109
+ Silk Asset Groups
110
+ *****************
111
+
112
+ .. note :: A Silk asset group will be created automatically for each branch that
113
+ is executed in CI.
114
+
115
+ We use Silk's *asset groups * to allow tracking of multiple versions of the
116
+ SBOM-lite _ simultaneously (i.e. one for each release branch). These asset groups
117
+ correspond to branches within the repository, and are created automatically when
118
+ CI executes for the first time on a particular branch. If you need an asset
119
+ group for a branch that has not run in CI, use the `+create-silk-asset-group `
120
+ Earthly target to create the asset group on-demand.
121
+
122
+ Note that Silk pulls from the upstream Git repository for an asset group, so
123
+ creating an asset group for a branch that does not exist in the main upstream
124
+ repository will not work.
125
+
126
+ .. file :: tools/create-silk-asset-group.py
127
+
128
+ A Python script that will create an `asset group <silk-asset-group> ` in Silk
129
+ based on a set of parameters. Execute with ``--help `` for more information.
130
+ For the C driver, it is easier to use the `+create-silk-asset-group ` Earthly
131
+ target.
132
+
133
+
134
+ .. _snyk scanning :
135
+
136
+ Snyk Scanning
137
+ *************
138
+
139
+ Snyk _ is a tool that detects dependencies and tracks vulnerabilities in
140
+ packages. Snyk is used in a limited fashion to detect vulnerabilities in the
141
+ bundled dependencies in the C driver repository.
142
+
143
+ .. _snyk caveats :
144
+
145
+ Caveats
146
+ =======
147
+
148
+ At the time of writing (June 20, 2024), Snyk has trouble scanning the C driver
149
+ repository for dependencies. If given the raw repository, it will detect the
150
+ mongo-c-driver package as the sole "dependency" of itself, and it fails to
151
+ detect the other dependencies within the project. The `+snyk-test ` Earthly
152
+ target is written to avoid this issue and allow Snyk to accurately detect other
153
+ dependencies within the project.
154
+
155
+ Due to difficulty coordinating the behavior of Snyk and Silk at time of
156
+ writing, vulnerability collection is partially a manual process. This is
157
+ especially viable as the native code contains a very small number of
158
+ dependencies and it is trivial to validate the output of Snyk by hand.
159
+
160
+ .. seealso :: The `releasing.snyk` step of the release process
161
+
162
+
163
+ .. _vuln-reporting :
164
+
165
+ 3rd-Party Dependency Vulnerability Reporting
166
+ ********************************************
167
+
168
+ Vulnerabilities in :term: `bundled dependencies <bundled dependency> ` are tracked
169
+ by Snyk, but we maintain a hand-written document that details the
170
+ vulnerabilities in current and past dependencies of in-support release versions.
171
+
172
+ .. file :: etc/third_party_vulnerabilities.md
173
+
174
+ The third-party dependency vulnerabily report. This file is stored in the
175
+ repository and updated manually as vulnerabilities are added/removed.
176
+
177
+ .. seealso :: At release-time, this file is added to the release archive. See:
178
+ `releasing.vuln-report `
179
+
180
+
181
+ Updating the Vulnerability Report
182
+ =================================
183
+
184
+ When updating `etc/third_party_vulnerabilities.md `, perform the following steps:
185
+
186
+ 1. Open the Snyk _ web UI and sign in via SSO.
187
+ 2. Open `this Snyk search query `__ (Find the **mongodb/mongo-c-driver ** CLI
188
+ target within the **dev-prod ** organization. Do not use the *GitHub target *:
189
+ That one is not currently useful to us.)
190
+
191
+ __ https://app.snyk.io/org/dev-prod/projects?searchQuery=mongo-c-driver&filters[Integrations]=cli
192
+ 3. Expand the **mongodb/mongo-c-driver ** target, and then expand all **currently
193
+ supported release versions **. (If you are preparing for a new release, that
194
+ version should also be available and used after the `releasing.snyk ` process
195
+ has been completed.)
196
+ 4. Take note of *all unique vulnerabilities amongst all supported versions' *
197
+ that are listed in Snyk. These will be the *relevant * vulnerabilities.
198
+ 5. For each relevant vulnerability that is not already listed in
199
+ `etc/third_party_vulnerabilities.md `, add a new entry under its corresponding
200
+ package heading that includes the details outlined in the `attribute table `
201
+ below. [#fixit ]_
202
+
203
+ 6. For each *already recorded * vulnerability :math: `V` listed in
204
+ `etc/third_party_vulnerabilities.md `:
205
+
206
+ 1. If :math: `V` is not *relevant * (i.e. it is no longer part of any
207
+ supported release version), delete its entry from
208
+ `etc/third_party_vulnerabilities.md `.
209
+ 2. Otherwise, update the entry for of :math: `V` according to the current
210
+ details of the codebase and Snyk report. [#fixit ]_
211
+
212
+ It is possible that no details need to be modified e.g. if the
213
+ vulnerability is old and already fixed in a past release.
214
+
215
+ 7. Save and commit the changes to `etc/third_party_vulnerabilities.md `.
216
+
217
+
218
+ .. _attribute table :
219
+
220
+ 3rd-Party Dependency Vulnerability Attributes
221
+ =============================================
222
+
223
+ The following attributes of external vulnerabilities must be recorded within
224
+ `etc/third_party_vulnerabilities.md `.
225
+
226
+ .. list-table ::
227
+
228
+ - - Attribute
229
+ - Explanation
230
+ - - **Date Detected **
231
+ - The ISO 8601 date at which the vulnerability was first detected.
232
+ - - **CVE Number **
233
+ - The CVE record number. Recommended to include a hyperlink to the CVE.
234
+
235
+ Example: `CVE-2023-45853 <https://www.cve.org/CVERecord?id=CVE-2023-45853 >`_
236
+ - - **Snyk Entry **
237
+ - A link to the Snyk entry in the Snyk Security database.
238
+
239
+ Example:
240
+ `SNYK-UNMANAGED-MADLERZLIB-5969359 <https://security.snyk.io/vuln/SNYK-UNMANAGED-MADLERZLIB-5969359 >`_.
241
+ - - **Severity **
242
+ - The severity of the vulnerability according to Snyk (Critical/High/Medium/Low)
243
+ - - **Description **
244
+ - Paste the description field from Snyk.
245
+ - - **Upstream Fix Status **
246
+ - One of "false positive", "won't fix", "fix pending", or "fix available".
247
+ If a fix is avilable, this entry should include the version number and
248
+ date at which the upstream project released a fix.
249
+ - - **mongo-c-driver Fix Status **
250
+ - One of "false positive", "won't fix", "fix pending", or "fix available".
251
+ If a fix is avilable, this entry should include the version number and
252
+ release date of the C driver that includes the fixed version. Use "fix
253
+ pending" if the bundled dependency has been upgraded but there has not
254
+ been a release that includes this upgrade.
255
+ - - **Notes **
256
+ - If a fix is available from the upstream package but has been purposefully
257
+ omitted from a C driver release, this field should explain the reasoning
258
+ for that omission.
259
+
260
+ Other notes about the vulnerability that may be useful to users and
261
+ future developers can also be included here.
262
+
263
+
264
+ .. rubric :: Example
265
+
266
+ The following is an example for a vulnerability listing in
267
+ `etc/third_party_vulnerabilities.md `
268
+
269
+ .. code-block :: markdown
270
+
271
+ # Zlib
272
+
273
+ ## CVE-2023-45853 - Integer Overflow or Wraparound
274
+
275
+ - **Date Detected**: 2024-06-24
276
+ - **CVE Number**: [CVE-2023-45853](https://www.cve.org/CVERecord?id=CVE-2023-45853)
277
+ - **Snyk Entry**: [SNYK-UNMANAGED-MADLERZLIB-5969359](https://security.snyk.io/vuln/SNYK-UNMANAGED-MADLERZLIB-5969359)
278
+ - **Severity**: High
279
+ - **Description**: Affected versions of this package are vulnerable to
280
+ Integer Overflow or Wraparound via the `MiniZip` function in `zlib`, by
281
+ providing a long filename, comment, or extra field.
282
+ - **Upstream Fix Status**: Fix available (1.3.1, 2024-01-22)
283
+ - **mongo-c-driver Fix Status**: Fix available (1.27.3, 2024-06-26)
284
+ - **Notes**: This issue was related to Zip file handling, which was not used
285
+ by mongo-c-driver. This errant code was never reachable via the C driver
286
+ APIs.
287
+
288
+
289
+ .. rubric :: Footnotes
290
+
106
291
.. [#f1 ]
107
292
108
- This may change in the future depending on how the process may evolve.
293
+ This may change in the future depending on how the process may evolve.
294
+
295
+ .. [#asbom-vulns ]
296
+
297
+ At time of writing, the vulnerabilities listing in the augmented SBOM is
298
+ incomplete and vulnerability collection is partially manual. See:
299
+ `snyk caveats ` and `releasing.vuln-report `.
300
+
301
+ .. [#fixit ]
302
+
303
+ If a fix is available and is reasonably easy to introduce, consider upgrading
304
+ the associated dependency to include a fix before the next release is
305
+ finalized.
306
+
307
+ If a fix is available but *not * applied, then the rationale for such a
308
+ decision will need to be included in the vulnerability listing (See the
309
+ **Notes ** section in the `attribute table `).
0 commit comments