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

Commit

Permalink
audit: Ensure we don't mutate the shrinkwrap
Browse files Browse the repository at this point in the history
PR-URL: #20389
Credit: @iarna
Reviewed-By: @zkat
  • Loading branch information
iarna authored and zkat committed Apr 20, 2018
1 parent f2386e1 commit 552ff6d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/install/audit.js
Expand Up @@ -22,6 +22,7 @@ const url = require('url')
const npa = require('npm-package-arg')
const uuid = require('uuid')
const ssri = require('ssri')
const cloneDeep = require('lodash.clonedeep')

// used when scrubbing module names/specifiers
const runId = uuid.v4()
Expand Down Expand Up @@ -100,7 +101,7 @@ function printFullReport (auditResult) {
}

function generate (shrinkwrap, requires, diffs, install, remove) {
const sw = Object.assign({}, shrinkwrap)
const sw = cloneDeep(shrinkwrap)
delete sw.lockfileVersion
sw.requires = scrubRequires(requires)
scrubDeps(sw.dependencies)
Expand Down

0 comments on commit 552ff6d

Please sign in to comment.