Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kymtwyf opened this issue Apr 19, 2023 · 1 comment
Open

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

kymtwyf opened this issue Apr 19, 2023 · 1 comment
Assignees

Comments

@kymtwyf
Copy link

kymtwyf commented Apr 19, 2023

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 ?

@stoyanovk stoyanovk self-assigned this Dec 14, 2023
@AlexMost AlexMost assigned AlexMost and unassigned stoyanovk Jan 5, 2024
@vovkvlad
Copy link

vovkvlad commented Mar 7, 2024

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

Stryzhevskyi added a commit to Stryzhevskyi/ttag that referenced this issue Mar 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants