From 47de8f5e1a4f0691c071396740c47a88b02b68ab Mon Sep 17 00:00:00 2001 From: Lars Willighagen Date: Mon, 17 Jun 2019 18:11:17 +0200 Subject: [PATCH] fix(config): Add ssri config 'error' option (#146) * fix(config): add more ssri config options Fixes: https://npm.community/t/npm-install-tgz-invalid-config-key-requested/2395 Ref: 10d5d9a8c2d42217e12eb16619ba9cc2f5751364 * test(write): integrity error test case --- put.js | 1 + test/put.js | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/put.js b/put.js index a60cc55..cb4057f 100644 --- a/put.js +++ b/put.js @@ -20,6 +20,7 @@ const PutOpts = figgyPudding({ gid: {}, single: {}, sep: {}, + error: {}, strict: {} }) diff --git a/test/put.js b/test/put.js index 8658be9..4762643 100644 --- a/test/put.js +++ b/test/put.js @@ -102,6 +102,16 @@ test('optionally memoizes data on stream insertion', t => { }) }) +test('errors if integrity errors', t => { + return BB.join( + put(CACHE, KEY, CONTENT, { + integrity: 'sha1-BaDDigEST' + }).catch(err => { + t.equal(err.code, 'EINTEGRITY', 'got error from bad integrity') + }) + ) +}) + test('signals error if error writing to cache', t => { return BB.join( put(CACHE, KEY, CONTENT, {