Skip to content

Commit

Permalink
Fix name vs group for scoped components in CycloneDX output
Browse files Browse the repository at this point in the history
  • Loading branch information
eoftedal committed Sep 26, 2024
1 parent 2b25f0b commit 83d7943
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 7 deletions.
6 changes: 6 additions & 0 deletions node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [5.2.4]

### Bugfix

- Fix name vs group for scoped components in CycloneDX output

## [5.2.3]

### Bugfix
Expand Down
2 changes: 1 addition & 1 deletion node/lib/retire.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

var exports = exports || {};
exports.version = '5.2.3';
exports.version = '5.2.4';

function isDefined(o) {
return typeof o !== 'undefined';
Expand Down
4 changes: 2 additions & 2 deletions node/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Erlend Oftedal <[email protected]>",
"name": "retire",
"description": "Retire is a tool for detecting use of vulnerable libraries",
"version": "5.2.3",
"version": "5.2.4",
"license": "Apache-2.0",
"repository": {
"type": "git",
Expand Down
4 changes: 3 additions & 1 deletion node/src/reporters/cyclonedx-1_6-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ function configureCycloneDXJSONLogger(logger: Logger, writer: Writer, config: Lo
existing.evidence.occurrences.push(...missing);
return undefined;
}
const nameParts = dep.component.split('/').reverse();
const result = {
type: 'library',
name: dep.component,
name: nameParts[0],
group: nameParts[1],
version: dep.version,
purl: purl,
hashes: hashes,
Expand Down
4 changes: 3 additions & 1 deletion node/src/reporters/cyclonedx-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@ function configureCycloneDXJSONLogger(logger: Logger, writer: Writer, config: Lo
existing.properties.push(...missing);
return undefined;
}
const nameParts = dep.component.split('/').reverse();
const result = {
type: 'library',
name: dep.component,
name: nameParts[0],
group: nameParts[1],
version: dep.version,
purl: purl,
hashes: hashes,
Expand Down
3 changes: 2 additions & 1 deletion node/src/reporters/cyclonedx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ function configureCycloneDXLogger(logger: Logger, writer: Writer, config: Logger
const purl = generatePURL(dep);
if (seen.has(purl)) return '';
seen.add(purl);
const nameParts = dep.component.split('/').reverse();
return `
<component type="library">
<name>${dep.component}</name>
<name>${nameParts[0]}</name>${nameParts.length > 1 ? `\n <group>${nameParts[1]}</group>` : ''}
<version>${dep.version}</version>${hashes}
<licenses>${mapLicenses(dep.licenses)}</licenses>
<purl>${purl}</purl>
Expand Down

0 comments on commit 83d7943

Please sign in to comment.