Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8031595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:09:11+00:00 2026-06-05T01:09:11+00:00

Here is my situation. I am building an application that contains some heavy mathematical

  • 0

Here is my situation. I am building an application that contains some heavy mathematical calculations where the formula needs to be editable by a sufficiently privileged, but untrusted, user.

I need a secure server side scripting language. I need to be able to access constants and values from 4+ database tables, the results of previous calculations, define user variables and functions, use if/then/else statements, and I’m sure more that I can’t think of right now.

Some options I’ve considered:

  1. I have considered using something like this matheval library but I would end up needing to extend it considerably for my use case. I would essentially be creating my own custom language.

  2. PHP runkit sandbox. I’ve never used this before but am very concerned about the security issues involved. Considering the possible security issues, I don’t think that this is a viable option.

  3. One other idea that has crossed my mind that I don’t know if it is possible would be to use something like javascript on the server side. I’ve seen js used as a scripting platform in desktop applications to extend functionality and it seems a similar approach may be feasible. I could ideally define the environment that things ran it, such as disabling filesystem access etc. Again, security seems like it would be an issue.

From the research I have done, it seems like #1 is probably my only option, but I thought I would check with a larger talent pool. 🙂

If #3 is possible, it seems that it would be the way to go, but I can’t seem to turn up anything that is helpful. On the other hand, there may not be much difference between #2 and #3.

Performance is another consideration. There will be roughly 65 some odd formulas each executing about 450 times. Each formula will have access to approximately 15 unique variables a hundred or so constants, and the results of previous formulas. (Yes, there is a specific order of execution.)

I can work with an asynchronous approach to calculation where the calculation would be initiated by a user event and stored in the db, but would prefer to not have to.

What is the best way to work with this situation? Are there any other third party libraries that I haven’t turned up in my research? Is there another option in addition to my 3 that I should consider?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:09:14+00:00Added an answer on June 5, 2026 at 1:09 am

    There’s almost no reason to create a custom language today. There’s so many available and hackable, writing your own is really a waste of time.

    If you’re not serving a zillion users (for assorted values of a zillion), most any modern scripting language is securable, especially if you’re willing to take draconian measures to do so (such as completely eliminating I/O and system interfaces).

    JavaScript is a valid option. Its straightforward to create mini-sandboxes within JS itself to run foreign code. If you want folks to be able to persist state across runs, simply require them store it in “JSON-like” JS structures that can be readily serialized from the system on exit, and just as easily reloaded. These can even be the results of the function.

    If there’s a function or routine you don’t want them to use, you can un-define it before firing off of the foreign code. Don’t want them using “read” to read a file? read = func(s) { }

    Obviously you should talk to the mailing lists of the JS implementation you want to use to get some tips for better securing it.

    But JS has good support, well documented, and the interpreters are really accessible.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my situation. I am building a small Windows Form that will launch
I've comp up against a formidable conundrum. Here's my situation: I'm building an application
I'm building the mail module for a line-of-business application. The situation is that when
I have an situation here that looks very like a SELECT N+1 from the
Here is my situation. I need to create a report that shows each open
I'm building a web application (using prototype) that requires the addition of large chunks
Here's the situation I have: I'm building an online system to be used by
I have an interesting situation here. I am building a board game and I
We're building a web app that customers can pay a monthly rate for. Here
Here is the work-flow of my situation: I have a website that allows registered

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.