Skip to content

Commit 47de8f5

Browse files
larsgwzkat
authored andcommitted
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: 10d5d9a * test(write): integrity error test case
1 parent 7799149 commit 47de8f5

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

put.js

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const PutOpts = figgyPudding({
2020
gid: {},
2121
single: {},
2222
sep: {},
23+
error: {},
2324
strict: {}
2425
})
2526

test/put.js

+10
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,16 @@ test('optionally memoizes data on stream insertion', t => {
102102
})
103103
})
104104

105+
test('errors if integrity errors', t => {
106+
return BB.join(
107+
put(CACHE, KEY, CONTENT, {
108+
integrity: 'sha1-BaDDigEST'
109+
}).catch(err => {
110+
t.equal(err.code, 'EINTEGRITY', 'got error from bad integrity')
111+
})
112+
)
113+
})
114+
105115
test('signals error if error writing to cache', t => {
106116
return BB.join(
107117
put(CACHE, KEY, CONTENT, {

0 commit comments

Comments
 (0)