You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// now we know the top node is vulnerable, and cannot be
222
-
// upgraded out of the bad place without --force. But, there's
223
-
// no need to add it to the actual vulns list, because nothing
224
-
// depends on root.
225
-
this.topVulns.set(vuln.name,vuln)
226
-
vuln.topNodes.add(topNode)
227
-
}
228
-
}
229
-
230
-
// check whether the top node is vulnerable.
231
-
// check whether we can get out of the bad place with --force, and if
232
-
// so, whether that update is SemVer Major
233
-
[_fixAvailable](topNode,vuln,spec){
234
-
// this will always be set to at least {name, versions:{}}
235
-
constpaku=vuln.packument
236
-
219
+
// given the spec, see if there is a fix available at all, and note whether or not it's a semver major fix or not (i.e. will need --force)
220
+
#fixAvailable (vuln,spec){
221
+
// TODO we return true, false, OR an object here. this is probably a bad pattern.
237
222
if(!vuln.testSpec(spec)){
238
223
returntrue
239
224
}
240
225
241
-
// similarly, even if we HAVE a packument, but we're looking for it
242
-
// somewhere other than the registry, and we got something vulnerable,
243
-
// then we're stuck with it.
226
+
// even if we HAVE a packument, if we're looking for it somewhere other than the registry and we have something vulnerable then we're stuck with it.
244
227
constspecObj=npa(spec)
245
228
if(!specObj.registry){
246
229
returnfalse
@@ -250,15 +233,13 @@ class AuditReport extends Map {
250
233
spec=specObj.subSpec.rawSpec
251
234
}
252
235
253
-
// We don't provide fixes for top nodes other than root, but we
254
-
// still check to see if the node is fixable with a different version,
255
-
// and if that is a semver major bump.
236
+
// we don't provide fixes for top nodes other than root, but we still check to see if the node is fixable with a different version, and note if that is a semver major bump.
256
237
try{
257
238
const{
258
239
_isSemVerMajor: isSemVerMajor,
259
240
version,
260
241
name,
261
-
}=pickManifest(paku,spec,{
242
+
}=pickManifest(vuln.packument,spec,{
262
243
...this.options,
263
244
before: null,
264
245
avoid: vuln.range,
@@ -274,7 +255,7 @@ class AuditReport extends Map {
274
255
thrownewError('do not call AuditReport.set() directly')
0 commit comments