Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: audit package mismatch in special case #5923

Merged
merged 1 commit into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions workspaces/arborist/lib/arborist/build-ideal-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,14 +619,16 @@ module.exports = cls => class IdealTreeBuilder extends cls {
continue
}

const { isSemVerMajor, version } = fixAvailable
// name may be different if parent fixes the dep
// see Vuln fixAvailable setter
const { isSemVerMajor, version, name: fixName } = fixAvailable
const breakingMessage = isSemVerMajor
? 'a SemVer major change'
: 'outside your stated dependency range'
log.warn('audit', `Updating ${name} to ${version}, ` +
log.warn('audit', `Updating ${fixName} to ${version}, ` +
`which is ${breakingMessage}.`)

await this[_add](node, { add: [`${name}@${version}`] })
await this[_add](node, { add: [`${fixName}@${version}`] })
nodesTouched.add(node)
}
}
Expand Down
3 changes: 3 additions & 0 deletions workspaces/arborist/lib/vuln.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class Vuln {
// - {name, version, isSemVerMajor} fix requires -f, is semver major
// - {name, version} fix requires -f, not semver major
// - true: fix does not require -f
// TODO: duped entries may require different fixes but the current
// structure does not support this, so the case were a top level fix
// corrects a duped entry may mean you have to run fix more than once
for (const v of this.via) {
// don't blow up on loops
if (v.fixAvailable === f) {
Expand Down