0

I am making a graphing calculator, and need a fast way to run a user inputted mathematical function (e.g. y = x^3 + 2).

Previously I was using the math.js evaluate function, however this was very slow. Now I have switched to using the JavaScript new Function() constructor, to generate a JavaScript function based on user input, however I am concerned about the security implications. If I parse any input using math.js, and ensure it is a valid mathematical expression that will not throw any errors in math.js, is there any possible scenario where this could still cause security concerns?

PAGAN
  • 1
  • 1
    Decent discussion in the docs: [Math.js: Security](https://mathjs.org/docs/expressions/security.html) – pilchard Mar 30 '23 at 12:27

0 Answers0