Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for CycloneDX 1.5 #58

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions acceptance.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
[ "$status" -eq 0 ]
}

@test "Not fail when testing a JavaScript CycloneDX 1.5 SBOM" {
run ./parlay ecosystems enrich testing/sbom.cyclonedx-1.5.json
[ "$status" -eq 0 ]
}

@test "Not fail when testing an SBOM on stdin" {
run bash -c "cat testing/sbom.cyclonedx.json | ./parlay ecosystems enrich -"
[ "$status" -eq 0 ]
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/snyk/parlay
go 1.20

require (
github.com/CycloneDX/cyclonedx-go v0.7.1
github.com/CycloneDX/cyclonedx-go v0.8.0
github.com/deepmap/oapi-codegen v1.12.4
github.com/edoardottt/depsdev v0.0.3
github.com/google/uuid v1.3.0
Expand Down
8 changes: 6 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/CycloneDX/cyclonedx-go v0.7.1 h1:5w1SxjGm9MTMNTuRbEPyw21ObdbaagTWF/KfF0qHTRE=
github.com/CycloneDX/cyclonedx-go v0.7.1/go.mod h1:N/nrdWQI2SIjaACyyDs/u7+ddCkyl/zkNs8xFsHF2Ps=
github.com/CycloneDX/cyclonedx-go v0.8.0 h1:FyWVj6x6hoJrui5uRQdYZcSievw3Z32Z88uYzG/0D6M=
github.com/CycloneDX/cyclonedx-go v0.8.0/go.mod h1:K2bA+324+Og0X84fA8HhN2X066K7Bxz4rpMQ4ZhjtSk=
github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk=
github.com/anchore/go-struct-converter v0.0.0-20221118182256-c68fdcfa2092 h1:aM1rlcoLz8y5B2r4tTLMiVTrMtpfY0O8EScKJxaSaEc=
github.com/anchore/go-struct-converter v0.0.0-20221118182256-c68fdcfa2092/go.mod h1:rYqSE9HbjzpHTI74vwPvae4ZVYZd1lue2ta6xHPdblA=
Expand Down Expand Up @@ -216,6 +216,10 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8=
github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
github.com/terminalstatic/go-xsd-validate v0.1.5 h1:RqpJnf6HGE2CB/lZB1A8BYguk8uRtcvYAPLCF15qguo=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down
192 changes: 192 additions & 0 deletions testing/sbom.cyclonedx-1.5.json
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paulrosca-snyk I noticed that the size of this fixture causes CI to take longer than necessary, since it will run parlay for real and make many requests to the ecosyste.ms API. should we decrease the number of dependencies (e.g. use only react with its 2 dependencies)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcombuechen Totally, I'll change the fixture to a smaller one.

Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.5",
"serialNumber": "urn:uuid:2bc89cc4-93e1-42cc-a0b6-5f6a305161fe",
"version": 1,
"metadata": {
"timestamp": "2024-02-19T15:41:53.826Z",
"tools": {
"components": [
{
"group": "@cyclonedx",
"name": "cdxgen",
"version": "10.1.2",
"purl": "pkg:npm/%40cyclonedx/[email protected]",
"type": "application",
"bom-ref": "pkg:npm/@cyclonedx/[email protected]",
"author": "OWASP Foundation",
"publisher": "OWASP Foundation"
}
]
},
"authors": [
{
"name": "OWASP Foundation"
}
],
"lifecycles": [
{
"phase": "build"
}
],
"component": {
"group": "",
"name": "parlay-test",
"version": "0.1.0",
"type": "application",
"purl": "pkg:npm/[email protected]",
"bom-ref": "pkg:npm/[email protected]",
"components": []
}
},
"components": [
{
"group": "",
"name": "react",
"version": "18.2.0",
"scope": "required",
"hashes": [
{
"alg": "SHA-512",
"content": "ff722331d6f62fd41b05d5a25b97b73f6fe7a70301694f661c24825333659f464261b71f4ec19b4c9ad4fe419e99d1f6216981da2a19fb3931b66aba834f5f19"
}
],
"purl": "pkg:npm/[email protected]",
"type": "framework",
"bom-ref": "pkg:npm/[email protected]",
"evidence": {
"identity": {
"field": "purl",
"confidence": 1,
"methods": [
{
"technique": "manifest-analysis",
"confidence": 1,
"value": "/Users/roscapaul/Documents/Playground/parlay-test/package-lock.json"
}
]
},
"occurrences": [
{
"location": "src/index.js#1"
}
]
},
"properties": [
{
"name": "SrcFile",
"value": "/Users/roscapaul/Documents/Playground/parlay-test/package-lock.json"
},
{
"name": "ResolvedUrl",
"value": "https://registry.npmjs.org/react/-/react-18.2.0.tgz"
},
{
"name": "ImportedModules",
"value": "react"
}
]
},
{
"group": "",
"name": "loose-envify",
"version": "1.4.0",
"scope": "optional",
"hashes": [
{
"alg": "SHA-512",
"content": "972bb13c6aff59f86b95e9b608bfd472751cd7372a280226043cee918ed8e45ff242235d928ebe7d12debe5c351e03324b0edfeb5d54218e34f04b71452a0add"
}
],
"purl": "pkg:npm/[email protected]",
"type": "library",
"bom-ref": "pkg:npm/[email protected]",
"evidence": {
"identity": {
"field": "purl",
"confidence": 1,
"methods": [
{
"technique": "manifest-analysis",
"confidence": 1,
"value": "/Users/roscapaul/Documents/Playground/parlay-test/package-lock.json"
}
]
}
},
"properties": [
{
"name": "SrcFile",
"value": "/Users/roscapaul/Documents/Playground/parlay-test/package-lock.json"
},
{
"name": "ResolvedUrl",
"value": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz"
}
]
},
{
"group": "",
"name": "js-tokens",
"version": "4.0.0",
"scope": "optional",
"hashes": [
{
"alg": "SHA-512",
"content": "45d2547e5704ddc5332a232a420b02bb4e853eef5474824ed1b7986cf84737893a6a9809b627dca02b53f5b7313a9601b690f690233a49bce0e026aeb16fcf29"
}
],
"purl": "pkg:npm/[email protected]",
"type": "library",
"bom-ref": "pkg:npm/[email protected]",
"evidence": {
"identity": {
"field": "purl",
"confidence": 1,
"methods": [
{
"technique": "manifest-analysis",
"confidence": 1,
"value": "/Users/roscapaul/Documents/Playground/parlay-test/package-lock.json"
}
]
}
},
"properties": [
{
"name": "SrcFile",
"value": "/Users/roscapaul/Documents/Playground/parlay-test/package-lock.json"
},
{
"name": "ResolvedUrl",
"value": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz"
}
]
}
],
"services": [],
"dependencies": [
{
"ref": "pkg:npm/[email protected]",
"dependsOn": []
},
{
"ref": "pkg:npm/[email protected]",
"dependsOn": [
"pkg:npm/[email protected]"
]
},
{
"ref": "pkg:npm/[email protected]",
"dependsOn": [
"pkg:npm/[email protected]"
]
},
{
"ref": "pkg:npm/[email protected]",
"dependsOn": [
"pkg:npm/[email protected]"
]
}
]
}
Loading