Re: Groovy sandboxing

Tommy Svensson <[email protected]> Sun, 2 Aug 2026 20:00:43 +0200
Newsgroups gmane.comp.lang.groovy.user
Message-ID <[email protected]>
--6a6f85db_6b944986_30d2
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

I have just learned that Larry has been drinking the MAGA CooiAid=21=C2=A0=


So don't expect any sanity from Oracle.=C2=A0

It might be better to create a Groovy GVM, and have an option to convert =
JVM binaries to GVM binaries on the fly at startup.=C2=A0

The Groovy compile should recognize JVM code in libraries and automatical=
ly convert them to =C2=A0GVM =C2=A0binaries. So when running code you are=
 completely in the Groovy world, but still have access to Java tools and =
libraries.=C2=A0

This will isolate Groovy more from Larry Boy=21
 =20

 =20
 =20
 Tommy Svensson
 =20
 tommy=40natusoft.se
 =20
  =20
  =20
 =20
  =20
  =20
  =20
 =20
  =20

 =20
 =20
 =20
=46r=C3=A5n:=C2=A0 =20
 Paolo Di Tommaso =20
 <paolo.ditommaso=40gmail.com> =20
 =20
Svara:=C2=A0 =20
 users=40groovy.apache.org =20
 <users=40groovy.apache.org> =20
 =20
Datum:=C2=A0 =20
 2 augusti 2026 at 15:01:29 =20
 =20
Till:=C2=A0 =20
 users=40groovy.apache.org =20
 <users=40groovy.apache.org> =20
 =20
=C3=84mne:=C2=A0 =20
  Re: Groovy sandboxing =20
 =20

 =20

 =20
 =20
  =20
   =20
    =20
    =20
    =20
      Leaving an exhaustive reply to core maintainers however I believe t=
hat would require running Groovy on Truffle (Graal polyglot API).=C2=A0 =20
      =20
      =20
 =20
      =20
     =20
       That would be cool, but I see no plan in that direction.=C2=A0 =20
     =20
 =20
      =20
      =20
 =20
      =20
      =20
      =20
 =20
      =20
     =20
       Paolo =20
     =20
 =20
    =20
 =20
    =20
 =20
     =20
     =20
       On Sat, Aug 1, 2026 at 11:34=E2=80=AFPM ski n < =20
      raymondmeester=40gmail.com> wrote: =20
      =20
 =20
     =20
 =20
      =20
       =20
       =20
         Groovy has always been a powerful scripting language. Now with a=
gents (for example created with Spring AI or Langchain4j) it's becoming =20
        =20
more common to run Groovy scripts from for example Java or Kotlin.=C2=A0 =
=20
        =20
 =20
        =20
The question is when third-party generated scripts from agents (or just a=
 script written by other developers) =20
        =20
run these scripts, how to run it safely and securely=3F =46or example by =
not giving it access to the file system, socket or environment. =20
        =20
 =20
        =20
I recently read the documentation of GraalVM on sandboxing: =20
        =20
 =20
        =20
 =20
        https://www.graalvm.org/latest/security-guide/sandboxing/ =20
        =20
 =20
        =20
There you can have guest code (JavaScript, Python, Wasm etc) that is a sa=
ndbox when started from the JVM/GraalVM. This works because guest languag=
es =20
        =20
run in a separate VM, truffle VM, where these restriction policies can be=
 applied. =20
        =20
 =20
        =20
Groovy as being a JVM language itself, runs natively on the JVM, and is v=
ery much integrated with other JVM languages such as Java. Historically t=
here have been several approaches to run Groovy restrictly such as: =20
        =20
 =20
        =20
SecureASTCustomizer =20
        =20
custom classloaders =20
        =20
SecurityManager (now removed from Java) =20
        =20
bytecode rewriting =20
        =20
custom compilation restrictions =20
        =20
 =20
        =20
Unfortunately, after the removal of the Java Security Manager, there is n=
o robust, built-in JVM mechanism for securely sandboxing arbitrary Groovy=
 code. =20
        =20
 =20
        =20
Are there any plans to allow strong sandboxing for Groovy embedded in ano=
ther JVM Language=3F =20
        =20
 =20
        =20
 =20
       =20
Raymond
--6a6f85db_6b944986_30d2
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

<style>body=7Bfont-family:Helvetica,Arial;font-size:13px=7D</style> =20
<div id=3D=22bloop=5Fcustomfont=22 style=3D=22font-family:Helvetica,Arial=
;font-size:13px; margin: 0px; line-height: auto;=22>
 I have just learned that Larry has been drinking the MAGA CooiAid=21&nbs=
p;
</div>
<div id=3D=22bloop=5Fcustomfont=22 style=3D=22font-family:Helvetica,Arial=
;font-size:13px; margin: 0px; line-height: auto;=22>
 <br />
</div>
<div id=3D=22bloop=5Fcustomfont=22 style=3D=22font-family:Helvetica,Arial=
;font-size:13px; margin: 0px; line-height: auto;=22>
 So don't expect any sanity from Oracle.&nbsp;
</div>
<div id=3D=22bloop=5Fcustomfont=22 style=3D=22font-family:Helvetica,Arial=
;font-size:13px; margin: 0px; line-height: auto;=22>
 <br />
</div>
<div id=3D=22bloop=5Fcustomfont=22 style=3D=22font-family:Helvetica,Arial=
;font-size:13px; margin: 0px; line-height: auto;=22>
 It might be better to create a Groovy GVM, and have an option to convert=
 JVM binaries to GVM binaries on the fly at startup.&nbsp;
</div>
<div id=3D=22bloop=5Fcustomfont=22 style=3D=22font-family:Helvetica,Arial=
;font-size:13px; margin: 0px; line-height: auto;=22>
 <br />
</div>
<div id=3D=22bloop=5Fcustomfont=22 style=3D=22font-family:Helvetica,Arial=
;font-size:13px; margin: 0px; line-height: auto;=22>
 The Groovy compile should recognize JVM code in libraries and automatica=
lly convert them to &nbsp;GVM &nbsp;binaries. So when running code you ar=
e completely in the Groovy world, but still have access to Java tools and=
 libraries.&nbsp;
</div>
<div id=3D=22bloop=5Fcustomfont=22 style=3D=22font-family:Helvetica,Arial=
;font-size:13px; margin: 0px; line-height: auto;=22>
 <br />
</div>
<div id=3D=22bloop=5Fcustomfont=22 style=3D=22font-family:Helvetica,Arial=
;font-size:13px; margin: 0px; line-height: auto;=22>
 This will isolate Groovy more from Larry Boy=21
</div> =20
<br /> =20
<div id=3D=22bloop=5Fsign=5F1785692137070040064=22 class=3D=22bloop=5Fsig=
n=22> =20
 <p style=3D=22margin: 0px; font-style: normal; font-variant-caps: normal=
; font-stretch: normal; font-size: 21px; line-height: normal; font-family=
: &quot;Bradley Hand&quot;; font-size-adjust: none; font-kerning: auto; f=
ont-variant-alternates: normal; font-variant-ligatures: normal; font-vari=
ant-numeric: normal; font-variant-east-asian: normal; font-variant-positi=
on: normal; font-variant-emoji: normal; font-feature-settings: normal; fo=
nt-optical-sizing: auto; font-variation-settings: normal;=22>Tommy Svenss=
on</p> =20
 <p style=3D=22margin: 0px; font-style: normal; font-variant-caps: normal=
; font-stretch: normal; font-size: 21px; line-height: normal; font-family=
: &quot;Bradley Hand&quot;; font-size-adjust: none; font-kerning: auto; f=
ont-variant-alternates: normal; font-variant-ligatures: normal; font-vari=
ant-numeric: normal; font-variant-east-asian: normal; font-variant-positi=
on: normal; font-variant-emoji: normal; font-feature-settings: normal; fo=
nt-optical-sizing: auto; font-variation-settings: normal;=22><a href=3D=22=
mailto:tommy=40natusoft.se=22>tommy=40natusoft.se</a></p> =20
 <div> =20
  <p style=3D=22margin: 0px; font-stretch: normal; font-size: 21px; line-=
height: normal; font-family: &quot;Bradley Hand&quot;; font-size-adjust: =
none; font-kerning: auto; font-variant-alternates: normal; font-variant-l=
igatures: normal; font-variant-numeric: normal; font-variant-east-asian: =
normal; font-variant-position: normal; font-feature-settings: normal; fon=
t-optical-sizing: auto; font-variation-settings: normal;=22><br /></p> =20
 </div> =20
 <div> =20
  <br /> =20
 </div> =20
</div> =20
<div class=3D=22airmail=5Fext=5Fon=22 style=3D=22color:black=22> =20
 <br />=46r=C3=A5n:&nbsp; =20
 <span style=3D=22color:black=22>Paolo Di Tommaso</span> =20
 <a href=3D=22mailto:paolo.ditommaso=40gmail.com=22>&lt;paolo.ditommaso=40=
gmail.com&gt;</a> =20
 <br />Svara:&nbsp; =20
 <span style=3D=22color:black=22>users=40groovy.apache.org</span> =20
 <a href=3D=22mailto:users=40groovy.apache.org=22>&lt;users=40groovy.apac=
he.org&gt;</a> =20
 <br />Datum:&nbsp; =20
 <span style=3D=22color:black=22>2 augusti 2026 at 15:01:29</span> =20
 <br />Till:&nbsp; =20
 <span style=3D=22color:black=22>users=40groovy.apache.org</span> =20
 <a href=3D=22mailto:users=40groovy.apache.org=22>&lt;users=40groovy.apac=
he.org&gt;</a> =20
 <br />=C3=84mne:&nbsp; =20
 <span style=3D=22color:black=22> Re: Groovy sandboxing <br /></span> =20
</div> =20
<br /> =20
<blockquote type=3D=22cite=22 class=3D=22clean=5Fbq=22> =20
 <span> =20
  <div> =20
   <div></div> =20
   <div> =20
    <div dir=3D=22ltr=22>
      Leaving an exhaustive reply to core maintainers however I believe t=
hat would require running Groovy on Truffle (Graal polyglot API).&nbsp; =20
     <div> =20
      <br /> =20
     </div> =20
     <div>
       That would be cool, but I see no plan in that direction.&nbsp; =20
     </div> =20
     <div> =20
      <br /> =20
     </div> =20
     <div> =20
      <br /> =20
     </div> =20
     <div>
       Paolo =20
     </div> =20
    </div> =20
    <br /> =20
    <div class=3D=22gmail=5Fquote gmail=5Fquote=5Fcontainer=22> =20
     <div dir=3D=22ltr=22 class=3D=22gmail=5Fattr=22>
       On Sat, Aug 1, 2026 at 11:34=E2=80=AFPM ski n &lt; =20
      <a href=3D=22mailto:raymondmeester=40gmail.com=22>raymondmeester=40=
gmail.com</a>&gt; wrote: =20
      <br /> =20
     </div> =20
     <blockquote class=3D=22gmail=5Fquote=22 style=3D=22margin:0px 0px 0p=
x 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex=22> =20
      <div dir=3D=22ltr=22> =20
       <div>
         Groovy has always been a powerful scripting language. Now with a=
gents (for example created with Spring AI or Langchain4j) it's becoming =20
        <br />more common to run Groovy scripts from for example Java or =
Kotlin.&nbsp; =20
        <br /> =20
        <br />The question is when third-party generated scripts from age=
nts (or just a script written by other developers) =20
        <br />run these scripts, how to run it safely and securely=3F =46=
or example by not giving it access to the file system, socket or environm=
ent. =20
        <br /> =20
        <br />I recently read the documentation of GraalVM on sandboxing:=
 =20
        <br /> =20
        <br /> =20
        <a href=3D=22https://www.graalvm.org/latest/security-guide/sandbo=
xing/=22 target=3D=22=5Fblank=22>https://www.graalvm.org/latest/security-=
guide/sandboxing/</a> =20
        <br /> =20
        <br />There you can have guest code (JavaScript, Python, Wasm etc=
) that is a sandbox when started from the JVM/GraalVM. This works because=
 guest languages =20
        <br />run in a separate VM, truffle VM, where these restriction p=
olicies can be applied. =20
        <br /> =20
        <br />Groovy as being a JVM language itself, runs natively on the=
 JVM, and is very much integrated with other JVM languages such as Java. =
Historically there have been several approaches to run Groovy restrictly =
such as: =20
        <br /> =20
        <br />SecureASTCustomizer =20
        <br />custom classloaders =20
        <br />SecurityManager (now removed from Java) =20
        <br />bytecode rewriting =20
        <br />custom compilation restrictions =20
        <br /> =20
        <br />Unfortunately, after the removal of the Java Security Manag=
er, there is no robust, built-in JVM mechanism for securely sandboxing ar=
bitrary Groovy code. =20
        <br /> =20
        <br />Are there any plans to allow strong sandboxing for Groovy e=
mbedded in another JVM Language=3F =20
        <br /> =20
        <br /> =20
       </div>Raymond =20
      </div> =20
     </blockquote> =20
    </div> =20
   </div> =20
  </div></span> =20
</blockquote>
--6a6f85db_6b944986_30d2--