Skip to content

Commit

Permalink
fix(urls): Replace hardcoded URL to advisory with a URL from audit re…
Browse files Browse the repository at this point in the history
…sponse (#34)
  • Loading branch information
melkikh authored and zkat committed Dec 18, 2018
1 parent 5e27893 commit e2fe95b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions reporters/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const report = function (data, options) {
{'Package': advisory.module_name},
{'Dependency of': `${resolution.path.split('>')[0]} ${resolution.dev ? '[dev]' : ''}`},
{'Path': `${resolution.path.split('>').join(Utils.color(' > ', 'grey', config.withColor))}`},
{'More info': `https://nodesecurity.io/advisories/${advisory.id}`}
{'More info': advisory.url || `https://www.npmjs.com/advisories/${advisory.id}`}
)

log(table.toString() + '\n\n')
Expand Down Expand Up @@ -160,7 +160,7 @@ const report = function (data, options) {
{'Patched in': patchedIn},
{'Dependency of': `${resolution.path.split('>')[0]} ${resolution.dev ? '[dev]' : ''}`},
{'Path': `${resolution.path.split('>').join(Utils.color(' > ', 'grey', config.withColor))}`},
{'More info': `https://nodesecurity.io/advisories/${advisory.id}`}
{'More info': advisory.url || `https://www.npmjs.com/advisories/${advisory.id}`}
)
log(table.toString())
})
Expand Down
4 changes: 2 additions & 2 deletions reporters/parseable.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const report = function (data, options) {
l.sevLevel = advisory.severity
l.severity = advisory.title
l.package = advisory.module_name
l.moreInfo = `https://nodesecurity.io/advisories/${advisory.id}`
l.moreInfo = advisory.url || `https://www.npmjs.com/advisories/${advisory.id}`
l.path = resolution.path

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

Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/some-same-action.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"exploitability": 5,
"affected_components": ""
},
"url": "https://nodesecurity.io/advisories/146"
"url": "https://www.npmjs.com/advisories/146"
},
"534": {
"findings": [
Expand Down Expand Up @@ -106,7 +106,7 @@
"exploitability": 5,
"affected_components": ""
},
"url": "https://nodesecurity.io/advisories/534"
"url": "https://www.npmjs.com/advisories/534"
}
},
"muted": [],
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/some-vulns-critical.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"exploitability": 5,
"affected_components": ""
},
"url": "https://nodesecurity.io/advisories/146"
"url": "https://www.npmjs.com/advisories/146"
}
},
"muted": [],
Expand Down

0 comments on commit e2fe95b

Please sign in to comment.