diff --git a/packages/dappfence/src/core/constants.js b/packages/dappfence/src/core/constants.js index fb6702e..3bbbfd0 100644 --- a/packages/dappfence/src/core/constants.js +++ b/packages/dappfence/src/core/constants.js @@ -72,6 +72,7 @@ export const VERIFICATION_STATUS = Object.freeze({ * | 'BODY_UNREADABLE' * | 'FETCH_BAD_STATUS' * | 'FETCH_EXCEPTION' + * | 'NO_MANIFEST_AVAILABLE' * } AssetErrorReason */ diff --git a/packages/dappfence/src/sw/manifest/security-verifier.js b/packages/dappfence/src/sw/manifest/security-verifier.js index 0501055..d39f1b6 100644 --- a/packages/dappfence/src/sw/manifest/security-verifier.js +++ b/packages/dappfence/src/sw/manifest/security-verifier.js @@ -230,6 +230,9 @@ export const createVerifier = ( } const fetched = await fetchAndStoreManifest(); + if (fetched.status.isViolation) { + return fetched; + } const fetchedResult = await tryManifest(fetched); if (manifestDecidedAbout(fetchedResult)) { pinClient(clientId, fetched); @@ -239,7 +242,10 @@ export const createVerifier = ( return ( [pinnedResult, latestResult, ...historicResults, fetchedResult].find( (r) => r !== null - ) ?? fetched + ) ?? { + status: VERIFICATION_STATUS.ERROR, + reason: 'NO_MANIFEST_AVAILABLE', + } ); };