-
-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Runtime limits on "bad neighbors". #2350
Comments
The VM fuzzer PR (#2401) adds a mechanism for restricting the number of instructions. Could probably be used to complete (1) here. |
Memory limits might also be worth adding to the list (unless this already exists), otherwise one bad actor can OOM the whole process and bring all other scripts with it. Also, I don't think limiting bytecode instructions is a good/reliable way to guard against lock ups, since this has no effect on native builtins. use boa_engine::Context;
fn main() {
let mut cx = Context::builder().instructions_remaining(500).build();
dbg!(cx.eval("/(a+)+b/.test('a'.repeat(31) + 'c');"));
} This piece of JS code uses 13 instructions until it gets stuck. There are plenty of other builtins that spend all of their time in native code and given long and complicated strings, can easily lock up the engine. Another example is |
If no body is working on |
As discussed on Discord (I'm Lyran Sage). We'd love to see some features added that can prevent untrusted code from preventing the execution of other tasks. It's our goal to be able to run several user provided scripts on the same thread at the same time (probably a runtime per execution).
To enable this to work and limit a single script from "blocking" the thread we need to have configurable limits on:
Anything else that you guys can think of that could possibly lock up execution? I think the above two covers everything though really?
Thanks so much!
David
The text was updated successfully, but these errors were encountered: