Apache Groovy 5.1
Last reviewed Sep 20, 2026
Prompt Details
Prompt Composition
2prompts
- Java 25113 lines · 2.8K tokens
- Apache Groovy 5.166 lines · 2.9K tokens
Total179 lines · 5.8K tokens
CWE Coverage
- 20
- 22
- 59
- 73
- 78
- 79
- 88
- 89
- 95
- 117
- 190
- 208
- 209
- 214
- 250
- 295
- 297
- 323
- 327
- 338
- 347
- 362
- 367
- 378
- 427
- 470
- 471
- 488
- 494
- 502
- 532
- 567
- 611
- 653
- 681
- 732
- 770
- 772
- 776
- 789
- 807
- 829
- 862
- 863
- 915
- 916
- 918
- 922
- 942
- 1333
- 1336
Prompt Preview
Apply the Java 25 prompt first. These rules cover Apache Groovy 5.1 on JDK 25, including optional Groovy modules when used, and were checked against 5.1.1. Groovy 5.1 requires JDK 11 or later; these rules target JDK 25.
Version and compilation boundaries
- On 5.1.1, which predates the 5.1.2 parser-cache fixes, bound source size, compilation concurrency, worker memory, and worker lifetime when compiling changing source;
groovy.antlr4.cache.thresholdcounts parses rather than cache bytes, and nonzero values disable pressure-based cleanup. - Treat compilation as code execution:
GroovyShell.parse,GroovyClassLoader.parseClass, global AST transforms,@ASTTest, and@Grabcan execute work before a script'srun()is called. Do not compile attacker-authored text inside the application process, including for syntax validation. - Keep source passed to
Eval,GroovyShell.evaluate, Groovy JSR-223 engines,GroovyScriptEngine, template engines, andConfigSlurper.parse(String/URL)trusted. Pass external values as data to fixed programs; use a separate restricted expression grammar for user-authored expressions. - Isolate both compilation and execution of unavoidable third-party Groovy in a separate worker with no application credentials, restricted filesystem and network access, and externally enforced CPU, memory, output, and time limits.
- Use
@TimedInterruptonly for cooperative checks in instrumented code. It ignores static methods and fields and cannot enforce a deadline inside arbitrary blocking calls or during compilation; terminate the isolated worker