How to protect against too long scripts?

Hi,

(Referring to this: Kill process instance when running in an infinite loop without wait state - #8 by camundaNewbie1)

Is there a way to configure some timeout on a script task (using the JavaScript language, if it helps), to protect against potential mistakes from users that would write some infinite loop or anything else equivalent to while(true) {}?

Or any way to detect intensive CPU usage and kill the guilty task? (stopping the process instance obviously does not work).

I have seen in the topic above that an “Interceptor” could somehow do the job, but it looks like I then have to write some very specific Java code, and I am using the “camunda run” Docker image, so I don’t know how easy it is to add Java code in it.

Also, as this topic is 4-year old, maybe some new features make this easier now?

Many thanks!