Skip to content

Commit ce1fcf3

Browse files
committedAug 16, 2024
Fix bug with deepscan
1 parent 56dfea1 commit ce1fcf3

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed
 

‎node/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [5.1.4]
4+
5+
### Bugfix
6+
7+
- Fix bug where deepScan would sometimes not report vulnerabilities
8+
39
## [5.1.3]
410

511
### Bugfix

‎node/lib/retire.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
var exports = exports || {};
7-
exports.version = '5.1.3';
7+
exports.version = '5.1.4';
88

99
function isDefined(o) {
1010
return typeof o !== 'undefined';

‎node/package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎node/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"author": "Erlend Oftedal <erlend@oftedal.no>",
33
"name": "retire",
44
"description": "Retire is a tool for detecting use of vulnerable libraries",
5-
"version": "5.1.3",
5+
"version": "5.1.4",
66
"license": "Apache-2.0",
77
"repository": {
88
"type": "git",

‎node/src/deepscan.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { multiQuery } from 'astronomical';
22
import { Component, Repository } from './types';
3+
import { check } from './retire';
34

45
export function deepScan(content: string, repo: Repository): Component[] {
56
const astQueries: Record<string, string> = {};
@@ -10,7 +11,7 @@ export function deepScan(content: string, repo: Repository): Component[] {
1011
backMap[`${name}_${i}`] = name;
1112
});
1213
});
13-
const results = multiQuery(content, astQueries) as Record<string,[]>;
14+
const results = multiQuery(content, astQueries) as Record<string, []>;
1415
const detected: Component[] = [];
1516
Object.entries(results).forEach(([key, value]) => {
1617
value.forEach((match) => {
@@ -27,7 +28,6 @@ export function deepScan(content: string, repo: Repository): Component[] {
2728
});
2829
return detected.reduce((acc, cur) => {
2930
if (acc.some((c) => c.component === cur.component && c.version === cur.version)) return acc;
30-
acc.push(cur);
31-
return acc;
31+
return acc.concat(check(cur.component, cur.version, repo));
3232
}, [] as Component[]);
3333
}

0 commit comments

Comments
 (0)
Failed to load comments.