Skip to content
This repository has been archived by the owner on Jul 3, 2019. It is now read-only.

Commit

Permalink
fix(integrity): stop defaulting to sha1 hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Nov 15, 2017
1 parent b61851e commit 62f8cdf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/finalize-manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function tarballedProps (pkg, spec, opts) {
needsShrinkwrap && jsonFromStream('npm-shrinkwrap.json', extracted),
needsManifest && jsonFromStream('package.json', extracted),
needsBin && getPaths(extracted),
needsHash && ssri.fromStream(tarStream, { algorithms: ['sha1'] }),
needsHash && ssri.fromStream(tarStream),
needsExtract && pipe(tarStream, extracted),
(sr, mani, paths, hash) => {
if (needsManifest && !mani) {
Expand Down
4 changes: 2 additions & 2 deletions test/finalize-manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ test('fills in integrity hash if missing', t => {
'package.json': base,
'npm-shrinkwrap.json': sr
}).then(tarData => {
const integrity = ssri.fromData(tarData, {algorithms: ['sha1']}).toString()
const integrity = ssri.fromData(tarData, {algorithms: ['sha512']}).toString()
tnock(t, OPTS.registry).get('/' + tarballPath).reply(200, tarData)
return finalizeManifest(base, {
name: base.name,
Expand Down Expand Up @@ -253,7 +253,7 @@ test('uses package.json as base if passed null', t => {
peerDependencies: {},
_resolved: OPTS.registry + tarballPath,
deprecated: false,
_integrity: ssri.fromData(tarData, {algorithms: ['sha1']}).toString(),
_integrity: ssri.fromData(tarData, {algorithms: ['sha512']}).toString(),
_shasum: null, // shasums are only when provided
_shrinkwrap: sr,
bin: { 'x': path.join('foo', 'x') },
Expand Down

0 comments on commit 62f8cdf

Please sign in to comment.