Skip to content
Open
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
6 changes: 5 additions & 1 deletion workspaces/arborist/lib/arborist/isolated-reifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ const getKey = (startNode) => {
.replace(/=+$/m, '')
// a patched entry gets a distinct, identifiable side-store key so unpatched consumers keep sharing the original
const patchSuffix = startNode.patched ? '+patch' : ''
return `${startNode.packageName}@${startNode.version}-${hash}${patchSuffix}`
// version comes straight from an untrusted package.json and this key becomes a
// path segment below (join('node_modules', '.store', key, ...)); strip separators
// so a crafted version can't traverse out of the store, matching packageName
const version = String(startNode.version).replace(/[/\\]/g, '_')
return `${startNode.packageName}@${version}-${hash}${patchSuffix}`
}

module.exports = cls => class IsolatedReifier extends cls {
Expand Down
Loading