Skip to content Skip to sidebar Skip to footer

How Do I Prevent Malicious Javascript In V8 (with Python)

I'm using PyV8 to run untrusted javascript. How can I detect and kill javascript that has inifinite, or long running loops in it? I'd like to tell v8 to run javascript and fail wit

Solution 1:

if it's python, you can use Interrupting cow:

from interruptingcow import timeout

try:
    with timeout(5, exception=RuntimeError):
        # perform a potentially very slow operationpassexcept RuntimeError:
    print"didn't finish within 5 seconds"

https://bitbucket.org/evzijst/interruptingcow

Post a Comment for "How Do I Prevent Malicious Javascript In V8 (with Python)"