Skip to content

Commit 1a3e948

Browse files
authored
go post build sbom (#924)
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
1 parent 849b09c commit 1a3e948

File tree

7 files changed

+75
-59
lines changed

7 files changed

+75
-59
lines changed

.github/workflows/repotests.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,16 @@ jobs:
353353
curl -LO https://github.com/owasp-dep-scan/dosai/releases/download/v0.1.1/Dosai-osx-arm64
354354
cd ..
355355
bin/cdxgen.js -p -t dotnet --lifecycle post-build -o bomresults/bom-binary.json bintests
356+
mkdir -p gobintests
357+
cd gobintests
358+
curl -LO https://github.com/anchore/syft/releases/download/v1.0.1/syft_1.0.1_linux_arm64.tar.gz
359+
tar -xvf syft_1.0.1_linux_arm64.tar.gz
360+
rm syft_1.0.1_linux_arm64.tar.gz
361+
curl -LO https://github.com/containerd/containerd/releases/download/v2.0.0-rc.0/containerd-static-2.0.0-rc.0-linux-amd64.tar.gz
362+
tar -xvf containerd-static-2.0.0-rc.0-linux-amd64.tar.gz
363+
rm containerd-static-2.0.0-rc.0-linux-amd64.tar.gz
364+
cd ..
365+
bin/cdxgen.js -p -t go --lifecycle post-build -o bomresults/bom-go-binary.json gobintests
356366
shell: bash
357367
- name: repotests 1.4
358368
run: |

bin/cdxgen.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,13 @@ const applyAdvancedOptions = (options) => {
348348
"oci",
349349
"android",
350350
"apk",
351-
"aab"
351+
"aab",
352+
"go",
353+
"golang"
352354
].includes(options.projectType)
353355
) {
354356
console.log(
355-
"PREVIEW: post-build lifecycle SBOM generation is supported only for android and dotnet projects. Please specify the type using the -t argument."
357+
"PREVIEW: post-build lifecycle SBOM generation is supported only for android, dotnet, and go projects. Please specify the type using the -t argument."
356358
);
357359
process.exit(1);
358360
}

deno.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cyclonedx/cdxgen",
3-
"version": "10.2.3",
3+
"version": "10.2.4",
44
"exports": "./index.js",
55
"compilerOptions": {
66
"allowJs": true,
@@ -38,10 +38,10 @@
3838
"exe": "deno compile --allow-read --allow-env --allow-run --allow-sys=uid,systemMemoryInfo,gid --allow-write --allow-net --output build/cdxgenx-devel bin/cdxgen.js"
3939
},
4040
"imports": {
41-
"@appthreat/atom": "npm:@appthreat/atom@2.0.8",
41+
"@appthreat/atom": "npm:@appthreat/atom@2.0.9",
4242
"@appthreat/cdx-proto": "npm:@appthreat/cdx-proto@^0.0.4",
43-
"@babel/parser": "npm:@babel/parser@^7.24.0",
44-
"@babel/traverse": "npm:@babel/traverse@^7.24.0",
43+
"@babel/parser": "npm:@babel/parser@^7.24.1",
44+
"@babel/traverse": "npm:@babel/traverse@^7.24.1",
4545
"@npmcli/arborist": "npm:@npmcli/arborist@7.4.0",
4646
"ajv": "npm:ajv@^8.12.0",
4747
"ajv-formats": "npm:ajv-formats@^2.1.1",

docs/ADVANCED.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ With profiles, cdxgen can generate a BOM that is optimized for a specific use ca
342342
343343
## BOM lifecycles
344344
345-
By default, cdxgen attempts to generate a BOM for the `build` lifecycle [phase](https://cyclonedx.org/docs/1.5/json/#tab-pane_metadata_lifecycles_items_oneOf_i0) for applications and `post-build` phase for container images. Using the argument, `--no-install-deps` it is possible to generate `pre-build` BOM for certain languages and ecosystems (Eg: Python) by disabling the package installation feature. Or explicitly pass `--lifecycle post-build` to generate an SBOM for android and dotnet binaries.
345+
By default, cdxgen attempts to generate a BOM for the `build` lifecycle [phase](https://cyclonedx.org/docs/1.5/json/#tab-pane_metadata_lifecycles_items_oneOf_i0) for applications and `post-build` phase for container images. Using the argument, `--no-install-deps` it is possible to generate `pre-build` BOM for certain languages and ecosystems (Eg: Python) by disabling the package installation feature. Or explicitly pass `--lifecycle post-build` to generate an SBOM for android, dotnet, and go binaries.
346346
347347
Example:
348348
@@ -354,6 +354,10 @@ cdxgen -t android --lifecycle post-build -o bom.json <path to apks>
354354
cdxgen -t dotnet --lifecycle post-build -o bom.json <path to dotnet binaries>
355355
```
356356
357+
```shell
358+
cdxgen -t go --lifecycle post-build -o bom.json <path to go binaries>
359+
```
360+
357361
## Nydus - next-generation container image
358362
359363
[Nydus](https://github.com/dragonflyoss/nydus) enhances the current OCI image specification by improving container launch speed, image space and network bandwidth efficiency, and data integrity. cdxgen container images are available in nydus format with the `-nydus` suffix.

jsr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cyclonedx/cdxgen",
3-
"version": "10.2.3",
3+
"version": "10.2.4",
44
"exports": "./index.js",
55
"include": ["*.js", "bin/**", "data/**", "types/**"],
66
"exclude": ["test/", "docs/", "contrib/", "ci/", "tools_config/"]

package-lock.json

Lines changed: 47 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cyclonedx/cdxgen",
3-
"version": "10.2.3",
3+
"version": "10.2.4",
44
"description": "Creates CycloneDX Software Bill of Materials (SBOM) from source or container image",
55
"homepage": "http://github.com/cyclonedx/cdxgen",
66
"author": "Prabhu Subramanian <prabhu@appthreat.com>",
@@ -57,8 +57,8 @@
5757
"url": "https://github.com/cyclonedx/cdxgen/issues"
5858
},
5959
"dependencies": {
60-
"@babel/parser": "^7.24.0",
61-
"@babel/traverse": "^7.24.0",
60+
"@babel/parser": "^7.24.1",
61+
"@babel/traverse": "^7.24.1",
6262
"@npmcli/arborist": "7.4.0",
6363
"ajv": "^8.12.0",
6464
"ajv-formats": "^2.1.1",
@@ -84,7 +84,7 @@
8484
"yargs": "^17.7.2"
8585
},
8686
"optionalDependencies": {
87-
"@appthreat/atom": "2.0.8",
87+
"@appthreat/atom": "2.0.9",
8888
"@appthreat/cdx-proto": "^0.0.4",
8989
"@cyclonedx/cdxgen-plugins-bin": "^1.5.8",
9090
"@cyclonedx/cdxgen-plugins-bin-arm64": "^1.5.8",

0 commit comments

Comments
 (0)