retire 4.2.3 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.3.1]
4
+
5
+ ### Bugfix
6
+
7
+ - Should always include detected libraries in SBOM reports regardless of if they are vulnerable or not
8
+
9
+ ## [4.3.0]
10
+
11
+ ### Changes
12
+
13
+ - Support basePurl in repository to generate purls in SBOM
14
+
3
15
  ## [4.2.3]
4
16
 
5
17
  ### Bugfix
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generatePURL = void 0;
4
4
  function generatePURL(component) {
5
+ if (component.basePurl) {
6
+ return component.basePurl + '@' + component.version;
7
+ }
5
8
  const compName = component.npmname || component.component;
6
9
  return `pkg:npm/${compName}@${component.version}`;
7
10
  }
package/lib/retire.js CHANGED
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  var exports = exports || {};
7
- exports.version = '4.2.3';
7
+ exports.version = '4.3.1';
8
8
 
9
9
  function isDefined(o) {
10
10
  return typeof o !== 'undefined';
@@ -29,7 +29,13 @@ function scan(data, extractor, repo, matcher) {
29
29
  var match = matcher(extractors[i], data);
30
30
  if (match) {
31
31
  match = match.replace(/(\.|-)min$/, '');
32
- detected.push({ version: match, component: component, npmname: repo[component].npmname, detection: extractor });
32
+ detected.push({
33
+ version: match,
34
+ component: component,
35
+ npmname: repo[component].npmname,
36
+ basePurl: repo[component].basePurl,
37
+ detection: extractor,
38
+ });
33
39
  }
34
40
  }
35
41
  }
@@ -65,7 +71,15 @@ function scanhash(hash, repo) {
65
71
  var hashes = repo[component].extractors.hashes;
66
72
  if (!isDefined(hashes)) continue;
67
73
  if (hashes.hasOwnProperty(hash)) {
68
- return [{ version: hashes[hash], component: component, npmname: repo[component].npmname, detection: 'hash' }];
74
+ return [
75
+ {
76
+ version: hashes[hash],
77
+ component: component,
78
+ npmname: repo[component].npmname,
79
+ basePurl: repo[component].basePurl,
80
+ detection: 'hash',
81
+ },
82
+ ];
69
83
  }
70
84
  }
71
85
  return [];
@@ -76,6 +90,7 @@ function check(results, repo) {
76
90
  var result = results[r];
77
91
  if (!isDefined(repo[result.component])) continue;
78
92
  var vulns = repo[result.component].vulnerabilities;
93
+ result.basePurl = repo[result.component].basePurl;
79
94
  result.npmname = repo[result.component].npmname;
80
95
  for (var i in vulns) {
81
96
  if (!isDefined(vulns[i].below) || !isAtOrAbove(result.version, vulns[i].below)) {
package/lib/scanner.js CHANGED
@@ -68,8 +68,6 @@ function filterAndEmitResults(finding, options) {
68
68
  finding.results.forEach((r) => (r.vulnerabilities = uniqueVulnerabilities(r.vulnerabilities)));
69
69
  if (options.ignore)
70
70
  removeIgnored(finding.results, options.ignore);
71
- if (!options.verbose)
72
- finding.results = finding.results.filter((f) => retire.isVulnerable([f]));
73
71
  if (finding.results.length == 0)
74
72
  return;
75
73
  if (retire.isVulnerable(finding.results)) {
package/lib/types.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  import { Logger } from './reporting';
3
3
  export type Repository = Record<string, {
4
4
  bowername?: string[];
5
+ basePurl?: string;
5
6
  npmname?: string;
6
7
  vulnerabilities: Vulnerability[];
7
8
  extractors: {
@@ -29,6 +30,7 @@ export type Vulnerability = {
29
30
  };
30
31
  export type Component = {
31
32
  component: string;
33
+ basePurl?: string;
32
34
  npmname?: string;
33
35
  version: string;
34
36
  vulnerabilities?: Vulnerability[];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "Erlend Oftedal <erlend@oftedal.no>",
3
3
  "name": "retire",
4
4
  "description": "Retire is a tool for detecting use of vulnerable libraries",
5
- "version": "4.2.3",
5
+ "version": "4.3.1",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",