addressing false positive jsverify rngState 8bf7605ea139db4c28

This commit is contained in:
El RIDO 2020-02-04 18:58:24 +01:00
parent 00438ec1ab
commit bab95cce1b
No known key found for this signature in database
GPG Key ID: 0F5C940A6BD81F92
1 changed files with 4 additions and 4 deletions

View File

@ -76,12 +76,12 @@ describe('I18n', function () {
params[0] = params[0].replace(/%(s|d)/g, '%%'); params[0] = params[0].replace(/%(s|d)/g, '%%');
postfix = postfix.replace(/%(s|d)/g, '%%'); postfix = postfix.replace(/%(s|d)/g, '%%');
const translation = DOMPurify.sanitize( const translation = DOMPurify.sanitize(
prefix + $.PrivateBin.Helper.htmlEntities(params[0]) + '<a></a>' + postfix, { prefix + '<a href="' + params[0] + '"></a>' + postfix, {
ALLOWED_TAGS: ['a', 'i', 'span'], ALLOWED_TAGS: ['a', 'i', 'span'],
ALLOWED_ATTR: ['href', 'id'] ALLOWED_ATTR: ['href', 'id']
} }
); );
params.unshift(prefix + '%s<a></a>' + postfix); params.unshift(prefix + '<a href="%s"></a>' + postfix);
const result = $.PrivateBin.I18n.translate.apply(this, params); const result = $.PrivateBin.I18n.translate.apply(this, params);
$.PrivateBin.I18n.reset(); $.PrivateBin.I18n.reset();
const alias = $.PrivateBin.I18n._.apply(this, params); const alias = $.PrivateBin.I18n._.apply(this, params);
@ -128,13 +128,13 @@ describe('I18n', function () {
params[0] = params[0].replace(/%(s|d)/g, '%%').trim(); params[0] = params[0].replace(/%(s|d)/g, '%%').trim();
postfix = postfix.replace(/%(s|d)/g, '%%').trim(); postfix = postfix.replace(/%(s|d)/g, '%%').trim();
const translation = DOMPurify.sanitize( const translation = DOMPurify.sanitize(
prefix + $.PrivateBin.Helper.htmlEntities(params[0]) + '<a></a>' + postfix, { prefix + '<a href="' + params[0] + '"></a>' + postfix, {
ALLOWED_TAGS: ['a', 'i', 'span'], ALLOWED_TAGS: ['a', 'i', 'span'],
ALLOWED_ATTR: ['href', 'id'] ALLOWED_ATTR: ['href', 'id']
} }
); );
let args = Array.prototype.slice.call(params); let args = Array.prototype.slice.call(params);
args.unshift(prefix + '%s<a></a>' + postfix); args.unshift(prefix + '<a href="%s"></a>' + postfix);
let clean = jsdom(); let clean = jsdom();
$('body').html('<div id="i18n"></div>'); $('body').html('<div id="i18n"></div>');
args.unshift($('#i18n')); args.unshift($('#i18n'));