From 028c8c3b1357b998d3f298d3d24aebaeb8c46e40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20S=C3=A1?= Date: Wed, 27 Apr 2022 16:00:08 +0100 Subject: [PATCH] fix: compute hash of the T&C text only --- lib/new-settings-loader.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/new-settings-loader.js b/lib/new-settings-loader.js index 9dbba793..a9af0f30 100644 --- a/lib/new-settings-loader.js +++ b/lib/new-settings-loader.js @@ -30,19 +30,18 @@ const SECRET_FIELDS = [ * JSON.stringify isn't necessarily deterministic so this function may compute * different hashes for the same object. */ -const md5hash = obj => +const md5hash = text => crypto .createHash('MD5') - .update(JSON.stringify(obj)) + .update(text) .digest('hex') const addTermsHash = configs => { - configs = _.omit('termsConditions_hash', configs) - const terms = getTermsConditions(configs) + const terms = _.omit(['hash'], getTermsConditions(configs)) return _.isEmpty(terms) ? configs : _.flow( - _.omit(['hash']), + _.get('text'), md5hash, hash => _.set('hash', hash, terms), setTermsConditions,