<div dir="ltr">So the answer is to create an agent and do whatever I need.<div><br>This is a lot of development with very low-level code (bytecode manipulation) that will not be achievable for every project. Moreover, each time there is bytecode manipulation, there is a risk that subsequent Java releases will break the code, making it less robust. There is a risk that the community will end up with tens of these agents with different behaviors, creating security holes.<div><br></div><div>Of course, we can intercept any call with an agent, but for some sensitive operations, I'm thinking particularly of file system access, this would have been great to have a builtin mechanism. I can live with plugins calling System.exit(); it can easily be monitored by standard operational tools and acted upon. However, file access would be much more complicated to verify via an agent as there are multiple API (without taking about cross-platform support), and it would have way more potential security implications (like accessing configuration files).</div></div><div><br></div><div><br></div><div>Anyway, thanks for your answer,</div><div>Loïc</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mar. 5 nov. 2024 à 19:36, Alex Buckley <<a href="mailto:alex.buckley@oracle.com">alex.buckley@oracle.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 11/5/2024 9:07 AM, Loïc MATHIEU wrote:<br>
> I already sent this feedback to this mailing list without an answer, so <br>
> I'm not sure if my first message was successfully delivered.<br>
> In doubt I'll resend it.<br>
> <br>
> On top of my mind, but I know that if a replacement would be created, it <br>
> would not be that one; something close to what we have with <br>
> structured concurrency would be great:<br>
> try <br>
> (SecurityScope.allowNewThread(false).allowNewProcesses(false).canExitVM(false).allowFileAccess(fileName -> file.startWith(workingDir)) {<br>
> // run the plugin code<br>
> plugin.run();<br>
> }<br>
<br>
You're saying that calls to some methods in the Java Platform API (e.g., <br>
System.exit) should be disallowed if they come from a plugin. We view <br>
this as "intercepting" calls to the Java Platform API. We recently <br>
updated JEP 486 to more clearly address this matter:<br>
<br>
<a href="https://openjdk.org/jeps/486#Intercepting-calls-to-the-Java-Platform-API" rel="noreferrer" target="_blank">https://openjdk.org/jeps/486#Intercepting-calls-to-the-Java-Platform-API</a><br>
<br>
Alex<br>
</blockquote></div>