Commit 03f81ba 1 parent 45997d8 commit 03f81ba Copy full SHA for 03f81ba
File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -185,12 +185,20 @@ function bucketPath (cache, key) {
185
185
186
186
module . exports . _hashKey = hashKey
187
187
function hashKey ( key ) {
188
- // sha1 conflicts can be generated, but it doesn't matter in this case,
188
+ // NOTE (SECURITY)
189
+ //
190
+ // `sha1` conflicts can be generated, but it doesn't matter in this case,
189
191
// since we intend for there to be regular conflicts anyway. You can have
190
192
// the entire cache in a single bucket and all that'll do is just make a big
191
193
// file with a lot of contention, if you can even pull it off in the `key`
192
194
// string. So whatever. `sha1` is faster and it doesn't trigger the warnings
193
195
// `md5` tends to (yet?...).
196
+ //
197
+ // Not to mention, that in the case of pacote/npm, the amount of control
198
+ // anyone would have over this key is so minimal that it's incredibly
199
+ // unlikely that they could intentionally generate a large number of
200
+ // conflicts just with a package key such that they'd do anything resembling
201
+ // a hash flood DOS.
194
202
return crypto
195
203
. createHash ( 'sha1' )
196
204
. update ( key . toLowerCase ( ) ) // lump case-variant keys into same bucket.
You can’t perform that action at this time.
0 commit comments