Skip to content
This repository was archived by the owner on Aug 11, 2022. It is now read-only.

Commit 552ff6d

Browse files
iarnazkat
authored andcommitted
audit: Ensure we don't mutate the shrinkwrap
PR-URL: #20389 Credit: @iarna Reviewed-By: @zkat
1 parent f2386e1 commit 552ff6d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/install/audit.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const url = require('url')
2222
const npa = require('npm-package-arg')
2323
const uuid = require('uuid')
2424
const ssri = require('ssri')
25+
const cloneDeep = require('lodash.clonedeep')
2526

2627
// used when scrubbing module names/specifiers
2728
const runId = uuid.v4()
@@ -100,7 +101,7 @@ function printFullReport (auditResult) {
100101
}
101102

102103
function generate (shrinkwrap, requires, diffs, install, remove) {
103-
const sw = Object.assign({}, shrinkwrap)
104+
const sw = cloneDeep(shrinkwrap)
104105
delete sw.lockfileVersion
105106
sw.requires = scrubRequires(requires)
106107
scrubDeps(sw.dependencies)

0 commit comments

Comments
 (0)