I'm new to V8 and plan on using it in a python web application. The purpose is to let users submit and execute certain JS scripts. Obviously this is a security threat so I'm looking for resources that document the ways one might 'lock down' v8. For example, can I create a white list of functions allowed to be called? Or a blacklist of libraries not allowed to be referenced?
How to "Lock down" V8?
Asked Answered
BTW why not allow them to submit Python scripts? This would simplify your architecture a bit I think. :-) (Had to mention it). And yes, it's possible to create a safe Python sandbox for those scripts –
Capella
@Capella how? I'm interested as well, but I keep reading everywhere that Python is nearly unsandboxable, with a thousand examples of how to break out –
Markland
If you use a plain V8 (i.e. not something like node.js) there won't be any dangerous functions. JavaScript itself doesn't have a stdlib containing filesystem functions etc.
The only thing a malicious user can do is creating infinite loops, deep recursions and memory hogs.
Sorry for the late comment, but I'm interested in this too. How can you prevent the user from exceeding a memory/processing quota? –
Markland
No idea. Please post a new question for this. –
Gelignite
I just posted a new question regarding this: #11637575 –
Amir
Would simply locking down the V8 instance (ie: giving it no permissions in a chroot) and killing the process if it doesn't return after a certain amount of time not work?
© 2022 - 2024 — McMap. All rights reserved.