Skip to content

ttag is using new Function on making plural strings against CSP  #261

@kymtwyf

Description

@kymtwyf

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 ?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions