From 4f371a05972ad7c4bbd34a23557d4135be74c870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Wed, 11 Apr 2018 20:14:23 -0700 Subject: [PATCH] fix(integrity): use new sri.match() for verification This should fix some more integrity warnings --- cache.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/cache.js b/cache.js index edb9b3d..0c519e6 100644 --- a/cache.js +++ b/cache.js @@ -234,15 +234,7 @@ function matchDetails (req, cached) { } } if (cached.integrity) { - const cachedSri = ssri.parse(cached.cacheIntegrity) - const sri = ssri.parse(cached.integrity) - const algo = sri.pickAlgorithm() - if (cachedSri[algo] && !sri[algo].some(hash => { - // cachedSri always has exactly one item per algorithm - return cachedSri[algo][0].digest === hash.digest - })) { - return false - } + return ssri.parse(cached.integrity).match(cached.cacheIntegrity) } reqUrl.hash = null cacheUrl.hash = null