ttag-org/ttag

ttag is using new Function on making plural strings against CSP

Opened this issue · 1 comments

to make the plural function:

function makePluralFunc(pluralStr) {
  /* eslint-disable no-new-func */
  var fn = fnCache[pluralStr];

  if (!fn) {
    fn = new Function('n', 'args', pluralFnBody(pluralStr));
    fnCache[pluralStr] = fn;
  }

  return fn;
}

the above code uses the new Function which validates againt Content Security Policy of browsers. How can I mitigate this usage ?

Any updates on this? Facing the same issue with CSP violation in our repo, and struggling to come up with an idea how to solve it.

Thnx