This looks very promising! The problem I most want to solve with this kind of library is execution of untrusted user-provided code in a sandbox. For that I need three things: 1. Total control over what APIs the user's code can call. I don't want their code being able to access the filesystem, or run subprocesses, or make network calls - not without me explicitly allowing a controlled subset of those things. 2. Memory…
Reviving PyMiniRacer: A Python JavaScript Bridge
11–16 of 16 posts
Re: Reviving PyMiniRacer: A Python <> JavaScript Bridge
#12I'm always excited by the idea of rendering jsx from Python in the same process. Mostly as a bridge between eg. an existing Django app and full SPA React land. You'd swap out the scrappy Django string templating with jsx, then once a page passes some frontend interaction complexity threshold shift it over entirely (with shared components between both). Could this project help achieve this or are imports/build process…
Re: Reviving PyMiniRacer: A Python <> JavaScript Bridge
#13This looks very promising! The problem I most want to solve with this kind of library is execution of untrusted user-provided code in a sandbox. For that I need three things: 1. Total control over what APIs the user's code can call. I don't want their code being able to access the filesystem, or run subprocesses, or make network calls - not without me explicitly allowing a controlled subset of those things. 2. Memory…
It should indeed be able to handle those requirements, and I think that matches the original use case from Sqreen.
Obviously, of course, there is no warranty and especially since I only recently adopted this project, I'd encourage anyone using this to run untrusted code go over the codebase and its assumptions very carefully.
And as far as running untrusted code goes, anything running V8 is subject to V8's stream of CVEs: https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=v8. Whereas V8 in your browser gets aggressively auto-updated by the browser's auto-update feature, PyMiniRacer's update schedule is unlikely to be as reliable (and depends on your own action to update your pip installation!).
N.B.: the memory limits operate on a per-context (per MiniRacer object) basis, even though (for historical reasons) you can (attempt to) set them on a per-eval basis.
Re: Reviving PyMiniRacer: A Python <> JavaScript Bridge
#14This looks very promising! The problem I most want to solve with this kind of library is execution of untrusted user-provided code in a sandbox. For that I need three things: 1. Total control over what APIs the user's code can call. I don't want their code being able to access the filesystem, or run subprocesses, or make network calls - not without me explicitly allowing a controlled subset of those things. 2. Memory…
Google's Starlark is a pretty good python-like language that does a lot of what you want, we use it at my company to run untrusted code. It's not exactly python, but a pretty good subset. It's deterministic, hermetically sealed and non-Turing complete.
Re: Reviving PyMiniRacer: A Python <> JavaScript Bridge
#15This looks very promising! The problem I most want to solve with this kind of library is execution of untrusted user-provided code in a sandbox. For that I need three things: 1. Total control over what APIs the user's code can call. I don't want their code being able to access the filesystem, or run subprocesses, or make network calls - not without me explicitly allowing a controlled subset of those things. 2. Memory…
New owner here! It should indeed be able to handle those requirements, and I think that matches the original use case from Sqreen. Obviously, of course, there is no warranty and especially since I only recently adopted this project, I'd encourage anyone using this to run untrusted code go over the codebase and its assumptions very carefully. And as far as running untrusted code goes, anything running V8 is subject to…
Re: Reviving PyMiniRacer: A Python <> JavaScript Bridge
#16This looks very promising! The problem I most want to solve with this kind of library is execution of untrusted user-provided code in a sandbox. For that I need three things: 1. Total control over what APIs the user's code can call. I don't want their code being able to access the filesystem, or run subprocesses, or make network calls - not without me explicitly allowing a controlled subset of those things. 2. Memory…
For the record PyMiniRacer was victim of a CVE itself https://nvd.nist.gov/vuln/detail/CVE-2020-25489 - a heap overflow, my mistake.
1. Total control over what APIs the user's code can call: you kinda got it... users can just do plain JS 2. Memory limits: you got it 3. Time limits: you got it, but the current model is unreliable when used at high levels of CPU and a high number of threads.
And thank you so much bpcreech for taking back the ownership of PyMiniRacer!