quickjs-emscripten icon indicating copy to clipboard operation
quickjs-emscripten copied to clipboard

shouldInterrupt for the amount of statements

Open Attacler opened this issue 1 year ago • 1 comments
trafficstars

Hi there,

We are currently looking for a library that safely executes code and where we can limit the amount of statements executed. I do see the shouldInterruptAfterDeadline function but there are no others. Is there anything comming for this or should we look into other libraries?

Thanks in advance for responding :)

Attacler avatar Oct 15 '24 07:10 Attacler

Documented in quickjs source code, the interrupt handler is called every 10k cycles (which rougly translated to this amount of statements). It's not perfectly granular, but suitable for sandboxing use cases. The example would interrupt after rougly ~10 million statements.

grafik

Entkenntnis avatar Jan 08 '25 20:01 Entkenntnis