Skip to content

Commit

Permalink
Fix bug with deepscan
Browse files Browse the repository at this point in the history
  • Loading branch information
eoftedal committed Aug 16, 2024
1 parent 56dfea1 commit ce1fcf3
Showing 5 changed files with 13 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.1.4]

### Bugfix

- Fix bug where deepScan would sometimes not report vulnerabilities

## [5.1.3]

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

var exports = exports || {};
exports.version = '5.1.3';
exports.version = '5.1.4';

function isDefined(o) {
return typeof o !== 'undefined';
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
@@ -2,7 +2,7 @@
"author": "Erlend Oftedal <erlend@oftedal.no>",
"name": "retire",
"description": "Retire is a tool for detecting use of vulnerable libraries",
"version": "5.1.3",
"version": "5.1.4",
"license": "Apache-2.0",
"repository": {
"type": "git",
6 changes: 3 additions & 3 deletions node/src/deepscan.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { multiQuery } from 'astronomical';
import { Component, Repository } from './types';
import { check } from './retire';

export function deepScan(content: string, repo: Repository): Component[] {
const astQueries: Record<string, string> = {};
@@ -10,7 +11,7 @@ export function deepScan(content: string, repo: Repository): Component[] {
backMap[`${name}_${i}`] = name;
});
});
const results = multiQuery(content, astQueries) as Record<string,[]>;
const results = multiQuery(content, astQueries) as Record<string, []>;
const detected: Component[] = [];
Object.entries(results).forEach(([key, value]) => {
value.forEach((match) => {
@@ -27,7 +28,6 @@ export function deepScan(content: string, repo: Repository): Component[] {
});
return detected.reduce((acc, cur) => {
if (acc.some((c) => c.component === cur.component && c.version === cur.version)) return acc;
acc.push(cur);
return acc;
return acc.concat(check(cur.component, cur.version, repo));
}, [] as Component[]);
}

0 comments on commit ce1fcf3

Please sign in to comment.