-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Pipe cyclonedx sbom to std_out (#194)
* added 'sbom' subcommand to pipe the cyclonedx bom to std_out so it can be picked up by other scanners * fixed the linting issues * pinned the production dependency on minimist from node-persist -> mkdirp -> [email protected] to [email protected] due to a security vuln failing our dogfood scan * added node script in package.json for an iq dogfood scan * made include license data false for getInstalledDeps, but getSbomFromCommand already had it as false so it didn't change IQ scan times. Might be worth stripping everything but the purls to keep it standard with the boms of the other tools * fixed linting errors and removed the vscode settings json as those options are going to differ locally * changed the circle-ci build to install from the package-lock.json * trying npm ci install... * removed the package-lock.json dependency * Spartan (#195) 💥 * implemented spartan bom for sbom output and iq scans Co-authored-by: Jeffry Hesse <[email protected]>
- Loading branch information
1 parent
0c6b4b6
commit 9bf2ae0
Showing
11 changed files
with
74 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,9 @@ const object = { | |
}, | ||
}; | ||
|
||
const expectedResponse = `<?xml version="1.0" encoding="utf-8"?><bom xmlns="http://cyclonedx.org/schema/bom/1.1" version="1"><components><component type="library" bom-ref="pkg:npm/[email protected]"><name>testdependency</name><version>1.0.1</version><description/><purl>pkg:npm/[email protected]</purl><externalReferences><reference type="issue-tracker"><url>git+ssh://[email protected]/slackhq/csp-html-webpack-plugin.git</url></reference></externalReferences></component><component type="library" bom-ref="pkg:npm/[email protected]"><name>testdependency2</name><version>1.0.2</version><description/><purl>pkg:npm/[email protected]</purl></component><component type="library" bom-ref="pkg:npm/[email protected]"><name>testdependency</name><version>1.0.0</version><description/><purl>pkg:npm/[email protected]</purl></component><component type="library" bom-ref="pkg:npm/%40scope/[email protected]"><group>@scope</group><name>testdependency3</name><version>1.0.2</version><description/><purl>pkg:npm/%40scope/[email protected]</purl></component></components></bom>`; | ||
const expectedResponse = `<?xml version="1.0" encoding="utf-8"?><bom xmlns="http://cyclonedx.org/schema/bom/1.1" version="1"><components><component type="library" bom-ref="pkg:npm/[email protected]"><name>testdependency</name><version>1.0.1</version><purl>pkg:npm/[email protected]</purl><description/><externalReferences><reference type="issue-tracker"><url>git+ssh://[email protected]/slackhq/csp-html-webpack-plugin.git</url></reference></externalReferences></component><component type="library" bom-ref="pkg:npm/[email protected]"><name>testdependency2</name><version>1.0.2</version><purl>pkg:npm/[email protected]</purl><description/></component><component type="library" bom-ref="pkg:npm/[email protected]"><name>testdependency</name><version>1.0.0</version><purl>pkg:npm/[email protected]</purl><description/></component><component type="library" bom-ref="pkg:npm/%40scope/[email protected]"><group>@scope</group><name>testdependency3</name><version>1.0.2</version><purl>pkg:npm/%40scope/[email protected]</purl><description/></component></components></bom>`; | ||
|
||
const expectedSpartanResponse = `<?xml version="1.0" encoding="utf-8"?><bom xmlns="http://cyclonedx.org/schema/bom/1.1" version="1"><components><component type="library" bom-ref="pkg:npm/[email protected]"><name>testdependency</name><version>1.0.1</version><purl>pkg:npm/[email protected]</purl></component><component type="library" bom-ref="pkg:npm/[email protected]"><name>testdependency2</name><version>1.0.2</version><purl>pkg:npm/[email protected]</purl></component><component type="library" bom-ref="pkg:npm/[email protected]"><name>testdependency</name><version>1.0.0</version><purl>pkg:npm/[email protected]</purl></component><component type="library" bom-ref="pkg:npm/%40scope/[email protected]"><group>@scope</group><name>testdependency3</name><version>1.0.2</version><purl>pkg:npm/%40scope/[email protected]</purl></component></components></bom>`; | ||
|
||
describe('CycloneDXSbomCreator', async () => { | ||
it('should create an sbom string given a minimal valid object', async () => { | ||
|
@@ -65,4 +67,12 @@ describe('CycloneDXSbomCreator', async () => { | |
|
||
expect(string).to.eq(expectedResponse); | ||
}); | ||
|
||
it('should create a spartan sbom string given a minimal valid object', async () => { | ||
const sbomCreator = new CycloneDXSbomCreator(process.cwd(), { spartan: true }); | ||
|
||
const string = await sbomCreator.createBom(object); | ||
|
||
expect(string).to.eq(expectedSpartanResponse); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters