Skip to content

core(vulnerable-libs): add fix for recovering from bad versions#3932

Merged
paulirish merged 2 commits intomasterfrom
try_catch_semver
Nov 29, 2017
Merged

core(vulnerable-libs): add fix for recovering from bad versions#3932
paulirish merged 2 commits intomasterfrom
try_catch_semver

Conversation

@patrickhulce
Copy link
Collaborator

fixes #3624

})

it('should fix bad version numbers', () => {
assert.equal(NoVulnerableLibrariesAudit.normalizeVersion('11.51'), '11.51.0');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we want it to do this?

Copy link
Collaborator Author

@patrickhulce patrickhulce Nov 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seemed reasonable to me as there were a lot in sentry, but I'm not sure any libraries that we for which we get just major.minor actually have a corresponding npm package

I'm fine to revert if you think its bad

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nah its fine

return vulns;
}

lib.pkgLink = 'https://snyk.io/vuln/npm:' + lib.npmPkgName
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do me a favor and update this line to

 lib.pkgLink = `https://snyk.io/vuln/npm:${lib.npmPkgName}#lh@${lib.version}`;

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heh done

return vulns;
}

try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idea: instead of try/catch we could make another call to semver.valid() . i don't care much either way. you?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well I wanted to reuse the error object it generates to beacon to sentry, but I suppose not the end of the world to create our own with captureMessage instead?

I'm don't feel particularly strongly either way

@paulirish paulirish merged commit e842834 into master Nov 29, 2017
@paulirish paulirish deleted the try_catch_semver branch November 29, 2017 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

jQuery slim build reports "invalid version"

2 participants