Skip to content

Commit 2dc41cc

Browse files
authored
Merge pull request #35 from RHEcosystemAppEng/sbom-npm-mvn-api
feat: add SBOM data model and support for npm and maven
2 parents 38ebfd4 + d872a4f commit 2dc41cc

File tree

64 files changed

+12471
-217
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+12471
-217
lines changed

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050

5151
- name: Run integration tests
5252
working-directory: integration
53-
run: bash ./run_its.sh
53+
run: EXHORT_ITS_USE_REAL_API=true bash ./run_its.sh
5454

5555
- name: Upload coverage reports
5656
if: ${{ matrix.node == env.MAIN_NODE_VER }}

README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ $ exhort-javascript-api component pom.xml "$(</path/to/pom.xml)"
121121
<h3>Supported Ecosystems</h3>
122122
<ul>
123123
<li><a href="https://www.java.com/">Java</a> - <a href="https://maven.apache.org/">Maven</a></li>
124+
<li><a href="https://www.javascript.com//">JavaScript</a> - <a href="https://www.npmjs.com//">Npm</a></li>
124125
</ul>
125126

126127
<h3>Excluding Packages</h3>
@@ -141,6 +142,34 @@ Excluding a package from any analysis can be achieved by marking the package for
141142
```
142143
</li>
143144

145+
</ul>
146+
<ul>
147+
<li>
148+
<em>Javascript NPM </em> users can add a root (key, value) pair with value of list of names (strings) to be ignored (without versions), and key called <b>exhortignore</b> in <em>package.json</em>, example:
149+
150+
```json
151+
{
152+
"name": "sample",
153+
"version": "1.0.0",
154+
"description": "",
155+
"main": "index.js",
156+
"keywords": [],
157+
"author": "",
158+
"license": "ISC",
159+
"dependencies": {
160+
"dotenv": "^8.2.0",
161+
"express": "^4.17.1",
162+
"jsonwebtoken": "^8.5.1",
163+
"mongoose": "^5.9.18"
164+
},
165+
"exhortignore": [
166+
"jsonwebtoken"
167+
]
168+
}
169+
170+
```
171+
</li>
172+
144173
</ul>
145174

146175
<h3>Customization</h3>
@@ -157,7 +186,8 @@ import fs from 'node:fs'
157186

158187
let options = {
159188
'EXHORT_SNYK_TOKEN': 'my-secret-snyk-token',
160-
'EXHORT_MVN_PATH': '/path/to/my/mvn'
189+
'EXHORT_MVN_PATH': '/path/to/my/mvn',
190+
'EXHORT_NPM_PATH': '/path/to/npm'
161191
}
162192

163193
// Get stack analysis in JSON format
@@ -208,6 +238,12 @@ following keys for setting custom paths for the said executables.
208238
<td><em>mvn</em></td>
209239
<td>EXHORT_MVN_PATH</td>
210240
</tr>
241+
<tr>
242+
<td><a href="https://www.npmjs.com/">NPM</a></td>
243+
<td><em>npm</em></td>
244+
<td>EXHORT_NPM_PATH</td>
245+
</tr>
246+
211247
</table>
212248

213249
<!-- Badge links -->

generated/backend/DependencyReportRecommendation.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
* Trusted Content recommendation that is not related to any security vulnerability
1616
*/
1717
export class DependencyReportRecommendation {
18+
/**
19+
* PackageURL identifier
20+
*/
21+
'purl'?: string;
1822
/**
1923
* <groupId>:<artifactId> for Java packages
2024
*/
@@ -27,6 +31,12 @@ export class DependencyReportRecommendation {
2731
static readonly discriminator: string | undefined = undefined;
2832

2933
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
34+
{
35+
"name": "purl",
36+
"baseName": "purl",
37+
"type": "string",
38+
"format": ""
39+
},
3040
{
3141
"name": "name",
3242
"baseName": "name",

generated/backend/PackageRef.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313

1414
export class PackageRef {
15+
/**
16+
* PackageURL identifier
17+
*/
18+
'purl'?: string;
1519
/**
1620
* <groupId>:<artifactId> for Java packages
1721
*/
@@ -24,6 +28,12 @@ export class PackageRef {
2428
static readonly discriminator: string | undefined = undefined;
2529

2630
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
31+
{
32+
"name": "purl",
33+
"baseName": "purl",
34+
"type": "string",
35+
"format": ""
36+
},
2737
{
2838
"name": "name",
2939
"baseName": "name",

integration/scenarios/maven/expected_component

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"transitive": 0
66
},
77
"vulnerabilities": {
8-
"total": 7,
98
"direct": 1,
9+
"total": 7,
1010
"critical": 1,
1111
"high": 3,
1212
"medium": 2,
@@ -23,35 +23,7 @@
2323
},
2424
"dependencies": [
2525
{
26-
"ref": {
27-
"name": "log4j:log4j",
28-
"version": "1.2.17"
29-
},
30-
"highestVulnerability": {
31-
"id": "SNYK-JAVA-LOG4J-1300176",
32-
"title": "Man-in-the-Middle (MitM)",
33-
"source": "snyk",
34-
"cvss": {
35-
"attackVector": "Network",
36-
"attackComplexity": "High",
37-
"privilegesRequired": "None",
38-
"userInteraction": "None",
39-
"scope": "Unchanged",
40-
"confidentialityImpact": "Low",
41-
"integrityImpact": "None",
42-
"availabilityImpact": "None",
43-
"exploitCodeMaturity": null,
44-
"remediationLevel": null,
45-
"reportConfidence": null,
46-
"cvss": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N"
47-
},
48-
"cvssScore": 3.7,
49-
"severity": "LOW",
50-
"cves": [
51-
"CVE-2020-9488"
52-
],
53-
"unique": false
54-
},
26+
"ref": "pkg:maven/log4j/[email protected]",
5527
"issues": [
5628
{
5729
"id": "SNYK-JAVA-LOG4J-572732",
@@ -230,8 +202,33 @@
230202
}
231203
],
232204
"transitive": [],
205+
"recommendation": null,
233206
"remediations": {},
234-
"recommendation": null
207+
"highestVulnerability": {
208+
"id": "SNYK-JAVA-LOG4J-1300176",
209+
"title": "Man-in-the-Middle (MitM)",
210+
"source": "snyk",
211+
"cvss": {
212+
"attackVector": "Network",
213+
"attackComplexity": "High",
214+
"privilegesRequired": "None",
215+
"userInteraction": "None",
216+
"scope": "Unchanged",
217+
"confidentialityImpact": "Low",
218+
"integrityImpact": "None",
219+
"availabilityImpact": "None",
220+
"exploitCodeMaturity": null,
221+
"remediationLevel": null,
222+
"reportConfidence": null,
223+
"cvss": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N"
224+
},
225+
"cvssScore": 3.7,
226+
"severity": "LOW",
227+
"cves": [
228+
"CVE-2020-9488"
229+
],
230+
"unique": false
231+
}
235232
}
236233
]
237234
}

0 commit comments

Comments
 (0)