Skip to content

Commit e2fe95b

Browse files
melkikhzkat
authored andcommitted
fix(urls): Replace hardcoded URL to advisory with a URL from audit response (#34)
1 parent 5e27893 commit e2fe95b

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

reporters/detail.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ const report = function (data, options) {
117117
{'Package': advisory.module_name},
118118
{'Dependency of': `${resolution.path.split('>')[0]} ${resolution.dev ? '[dev]' : ''}`},
119119
{'Path': `${resolution.path.split('>').join(Utils.color(' > ', 'grey', config.withColor))}`},
120-
{'More info': `https://nodesecurity.io/advisories/${advisory.id}`}
120+
{'More info': advisory.url || `https://www.npmjs.com/advisories/${advisory.id}`}
121121
)
122122

123123
log(table.toString() + '\n\n')
@@ -160,7 +160,7 @@ const report = function (data, options) {
160160
{'Patched in': patchedIn},
161161
{'Dependency of': `${resolution.path.split('>')[0]} ${resolution.dev ? '[dev]' : ''}`},
162162
{'Path': `${resolution.path.split('>').join(Utils.color(' > ', 'grey', config.withColor))}`},
163-
{'More info': `https://nodesecurity.io/advisories/${advisory.id}`}
163+
{'More info': advisory.url || `https://www.npmjs.com/advisories/${advisory.id}`}
164164
)
165165
log(table.toString())
166166
})

reporters/parseable.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const report = function (data, options) {
3232
l.sevLevel = advisory.severity
3333
l.severity = advisory.title
3434
l.package = advisory.module_name
35-
l.moreInfo = `https://nodesecurity.io/advisories/${advisory.id}`
35+
l.moreInfo = advisory.url || `https://www.npmjs.com/advisories/${advisory.id}`
3636
l.path = resolution.path
3737

3838
accumulator[advisory.severity] += [action.action, l.package, l.sevLevel, l.recommendation, l.severity, l.moreInfo, l.path, l.breaking]
@@ -47,7 +47,7 @@ const report = function (data, options) {
4747
l.sevLevel = advisory.severity
4848
l.severity = advisory.title
4949
l.package = advisory.module_name
50-
l.moreInfo = `https://nodesecurity.io/advisories/${advisory.id}`
50+
l.moreInfo = advisory.url || `https://www.npmjs.com/advisories/${advisory.id}`
5151
l.patchedIn = advisory.patched_versions.replace(' ', '') === '<0.0.0' ? 'No patch available' : advisory.patched_versions
5252
l.path = resolution.path
5353

test/fixtures/some-same-action.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"exploitability": 5,
6565
"affected_components": ""
6666
},
67-
"url": "https://nodesecurity.io/advisories/146"
67+
"url": "https://www.npmjs.com/advisories/146"
6868
},
6969
"534": {
7070
"findings": [
@@ -106,7 +106,7 @@
106106
"exploitability": 5,
107107
"affected_components": ""
108108
},
109-
"url": "https://nodesecurity.io/advisories/534"
109+
"url": "https://www.npmjs.com/advisories/534"
110110
}
111111
},
112112
"muted": [],

test/fixtures/some-vulns-critical.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"exploitability": 5,
5858
"affected_components": ""
5959
},
60-
"url": "https://nodesecurity.io/advisories/146"
60+
"url": "https://www.npmjs.com/advisories/146"
6161
}
6262
},
6363
"muted": [],

0 commit comments

Comments
 (0)