Skip to content

Commit a084afc

Browse files
committed
made script for generating sbom csv
1 parent 8621893 commit a084afc

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ resources/public/admin:
2323
# All other phony targets run lrsql instances that can be used and tested
2424
# during development. All start up with fixed DB properties and seed creds.
2525

26-
.phony: clean-dev, ci, ephemeral, ephemeral-prod, sqlite, postgres, mariadb, mysql, bench, bench-async, keycloak-demo, ephemeral-oidc, superset-demo, clamav-demo, test-sqlite, test-postgres, test-postgres-14, test-postgres-15, test-postgres-16, test-postgres-17, test-postgres-18, test-mariadb, test-mariadb-10.6, test-mariadb-10.11, test-mariadb-11.4, test-mariadb-11.7.2, test-mariadb-11.8, test-mysql, test-mysql-8.0.44, test-mysql-8.4, test-mysql-9.5.0
26+
.phony: clean-dev, ci, ephemeral, ephemeral-prod, sqlite, postgres, mariadb, mysql, bench, bench-async, keycloak-demo, ephemeral-oidc, superset-demo, clamav-demo, test-sqlite, test-postgres, test-postgres-14, test-postgres-15, test-postgres-16, test-postgres-17, test-postgres-18, test-mariadb, test-mariadb-10.6, test-mariadb-10.11, test-mariadb-11.4, test-mariadb-11.7.2, test-mariadb-11.8, test-mysql, test-mysql-8.0.44, test-mysql-8.4, test-mysql-9.5.0, sbom, sbom-csv
2727

2828
clean-dev:
2929
rm -rf *.db *.log resources/public tmp
@@ -364,6 +364,16 @@ run-jar-mysql: target/bundle
364364
pom.xml:
365365
clojure -Adb-sqlite:db-postgres -Spom
366366

367+
sbom: pom.xml
368+
mvn -q org.cyclonedx:cyclonedx-maven-plugin:makeAggregateBom \
369+
-DoutputFormat=json \
370+
-DoutputName=lrsql \
371+
-DschemaVersion=1.6 \
372+
-DprojectType=application
373+
374+
sbom-csv: sbom
375+
jq -r -f ./dev-resources/sbom/sbom_flat.jq ./target/lrsql.json > ./target/lrsql-sbom.csv
376+
367377
# TODO: Add a local vulnerability checker.
368378
# Note that we removed our previous one that used nvd-clojure as that app was
369379
# becoming too unreliable; perhaps look into clj-watson?

dev-resources/sbom/sbom_flat.jq

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
def pkg_name(c):
2+
if (c.group? // "") != "" then "\(c.group)/\(c.name)" else (c.name // "") end;
3+
4+
[
5+
.metadata.component?,
6+
.components[]?
7+
]
8+
| map(select(. != null))
9+
| map({
10+
package: pkg_name(.),
11+
source: (.purl // .["bom-ref"] // .author // .publisher // "unknown"),
12+
version: (.version // "unknown")
13+
})
14+
| unique
15+
| sort_by(.package, .version)
16+
| (["package","source","version"] | @csv),
17+
(.[] | [ .package, .source, .version ] | @csv)

0 commit comments

Comments
 (0)