Skip to content

Commit

Permalink
[demo-ui] call cyclonedx-npm from frontend-maven-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernard31 committed Nov 27, 2024
1 parent cbf9173 commit a260d07
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
7 changes: 1 addition & 6 deletions .jenkins/weekly.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,9 @@ pipeline {
sh ''' mvn -B clean install javadoc:javadoc -PeclipseJenkins -DskipTests'''
}

// Generate SBOM for maven
// Generate SBOM for maven (SBOM for frontend are automatically created during default build)
sh ''' mvn org.cyclonedx:cyclonedx-maven-plugin:makeBom '''

// Generate SBOM for npm with trivy
// We should generate sbom with cyclonedx-npm see : https://github.com/eclipse-leshan/leshan/issues/1550#issuecomment-1878802371
sh ''' trivy fs leshan-demo-server/webapp --format cyclonedx --output leshan-demo-server/target/bom-frontend.json --include-dev-deps '''
sh ''' trivy fs leshan-demo-bsserver/webapp --format cyclonedx --output leshan-demo-bsserver/target/bom-frontend.json --include-dev-deps '''

// check for vulnerabilities
// "find" to search file
// xargs to get correct exit code (find always return 0)
Expand Down
6 changes: 5 additions & 1 deletion .trivyignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
# ------------
# No affected by this vulnerability : we don't use parseHTML and close tag correctly.
# See : https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-9506
# could be remove after :
# could be remove after : https://github.com/eclipse-leshan/leshan/issues/1665
CVE-2024-9506

# We need to wait for : https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1079
CVE-2024-34394
CVE-2024-34393

# =========================
# About Leshan Libraries
# =========================
Expand Down
16 changes: 16 additions & 0 deletions build-config/demo-build-config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,22 @@ Contributors:
<arguments>run build</arguments>
</configuration>
</execution>
<execution>
<?m2e ignore?>
<id>npm sbom</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<environmentVariables>
<!-- this variable will be used by package.json -->
<OUTPUT_FORMAT>json</OUTPUT_FORMAT>
<OUTPUT_BOM_NAME>bom-frontend</OUTPUT_BOM_NAME>
<OUTPUT_BOM_DIRECTORY>${project.build.directory}</OUTPUT_BOM_DIRECTORY>
</environmentVariables>
<arguments>run sbom_maven</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand Down
3 changes: 2 additions & 1 deletion leshan-demo-bsserver/webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"preview": "vite preview",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src",
"report": "REPORT=true vite build --emptyOutDir",
"sbom": "cyclonedx-npm --output-format json --output-file ../target/sbom-frontend.json"
"sbom": "cyclonedx-npm --output-format json --output-file ../target/sbom-frontend.json",
"sbom_maven": "cyclonedx-npm --output-format ${OUTPUT_FORMAT} --output-file ${OUTPUT_BOM_DIRECTORY}/${OUTPUT_BOM_NAME}.${OUTPUT_FORMAT}"
},
"dependencies": {
"@fontsource/roboto": "^4.5.0",
Expand Down
3 changes: 2 additions & 1 deletion leshan-demo-server/webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"preview": "vite preview",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src",
"report": "REPORT=true vite build --emptyOutDir",
"sbom": "cyclonedx-npm --output-format json --output-file ../target/sbom-frontend.json"
"sbom": "cyclonedx-npm --output-format json --output-file ../target/sbom-frontend.json",
"sbom_maven": "cyclonedx-npm --output-format ${OUTPUT_FORMAT} --output-file ${OUTPUT_BOM_DIRECTORY}/${OUTPUT_BOM_NAME}.${OUTPUT_FORMAT}"
},
"dependencies": {
"@fontsource/roboto": "^4.5.0",
Expand Down

0 comments on commit a260d07

Please sign in to comment.