Apache Groovy 4.0
Last reviewed Sep 20, 2026
Prompt Details
Prompt Composition
2prompts
- Java 21124 lines · 3.9K tokens
- Apache Groovy 4.066 lines · 3K tokens
Total190 lines · 6.9K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 79
- 88
- 89
- 95
- 116
- 117
- 190
- 197
- 208
- 209
- 250
- 295
- 297
- 306
- 323
- 327
- 338
- 347
- 362
- 367
- 378
- 427
- 470
- 471
- 488
- 489
- 494
- 502
- 532
- 552
- 611
- 653
- 704
- 732
- 759
- 770
- 772
- 776
- 807
- 829
- 862
- 863
- 915
- 916
- 918
- 922
- 1333
- 1336
Prompt Preview
Apply the Java 21 prompt first for Apache Groovy 4.0 deployments on JDK 21. Apply these additional rules to Groovy scripts, compiler extensions, dynamic dispatch, data access, parsing, templates, and deployment helpers; they were checked against 4.0.33.
Scripts and compiler authority
- Keep source passed to
GroovyShell.evaluateorparse,GroovyClassLoader.parseClass,Eval,GroovyScriptEngine, and Groovy's JSR-223 engine trusted. Pass external values as data to reviewed scripts instead of interpolating them into source; use a small parsed grammar for user-authored expressions. - Treat
ConfigSlurper.parse(String),parse(URL), and script-based configuration as code execution. Use a non-executable data format for configuration supplied by users or external services. - Apply the script trust boundary before compilation: local and global AST transformations, including
@ASTTest, can execute beforeScript.run(). Keep compiler configuration scripts, type-checking extensions, script base classes, classpaths, and transformation artifacts under application control. - Compile and execute unavoidable third-party scripts in an isolated worker process with no application credentials, restricted filesystem and network access, and enforced CPU, memory, output, and lifetime limits. Do not use Groovy's optional Security Manager integration as the isolation boundary.
- Use
@ThreadInterruptor@TimedInterruptonly as cooperative checks for reviewed code. They do not impose a hard deadline on compilation or blocking library calls;@TimedInterruptdoes not cover