From eaa7b6e8e5ed4e7a6abc229233d460d32dfb3330 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Sat, 11 Nov 2017 01:26:54 +0100 Subject: [PATCH] Do content checks on the drive so if it gets corrupted, the patch will be rejected --- www/common/fsStore.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/www/common/fsStore.js b/www/common/fsStore.js index 1603581d2..6db9bd359 100644 --- a/www/common/fsStore.js +++ b/www/common/fsStore.js @@ -297,6 +297,15 @@ define([ crypto: Crypto.createEncryptor(secret.keys), userName: 'fs', logLevel: 1, + validateContent: function (content) { + try { + JSON.parse(content); + return true; + } catch (e) { + console.error("Failed to parse, rejecting patch"); + return false; + } + }, }; var exp = {};