Hub rules-groovy

rules-groovy

v3 public Verified

Groovy

Apache Groovy is a powerful, optionally typed and dynamic language with static-typing and static-compilation capabilities. These rules govern Groovy scripting, Jenkinsfile development, and dynamic code execution for AI agents.

@sigmashakeinc 2 pulls 9 rules published Apr 8, 2026 synced Nov 22, 2026 sigmashakeinc/rules/rulesets/rules-groovy →
Severity
7 error 2 warn 0 info
demo.cast
Apache Groovy is a powerful, optionally typed and dynamic language with static-typing and static-compilation capabilities. These rules govern Groovy scripting, Jenkinsfile development, and dynamic code execution for AI agents.

Rules index

9 governance rules

Indexed from the repository's .rules files, grouped by technology. Expand any rule to read the raw source.

groovy

groovy-command-injection error block

RISK: Groovy's String.execute() with GString interpolation of variables is shell command injection. If any interpolated variable contains user input, attackers can run arbitrary OS commands (CWE-78). FIX: Use ProcessBuilder with a tokenized argument list (no shell interpretation), or the Process API with explicit argument arrays.

Rule source requires an active Pro or Enterprise subscription.
groovy-evaluate-rce error block

RISK: Groovy's evaluate() compiles and runs an arbitrary string as Groovy code. Any user-controlled input reaching evaluate() is Remote Code Execution (CWE-94). FIX: Replace evaluate() with a safe expression parser (e.g., MVEL with a sandbox, or a typed configuration DSL); never pass user input to evaluate().

Rule source requires an active Pro or Enterprise subscription.
groovy-grab-dependency-confusion warning log

RISK: @Grab/@GrabResolver downloads dependencies at script execution time. A dependency confusion attack (publishing a higher-version package with the same groupId:artifactId to a public registry) can inject malicious code. FIX: Pin exact versions in @Grab, lock the resolver to an internal repository; prefer build-time dependency management (Gradle/Maven) over runtime @Grab.

Rule source requires an active Pro or Enterprise subscription.
groovy-path-traversal error block

RISK: Constructing File paths from GString-interpolated variables without canonicalization enables path traversal (CWE-22). An attacker passes ../../etc/passwd as input to read arbitrary files. FIX: Resolve the path via new File(baseDir, untrusted).canonicalFile and verify it starts with the expected base directory before any read/write.

Rule source requires an active Pro or Enterprise subscription.
groovy-script-engine-injection error block

RISK: Obtaining a Groovy JSR-223 script engine and calling eval() on user-controlled input is Remote Code Execution — identical risk to GroovyShell.evaluate(). FIX: Compile and cache scripts at startup with trusted, static expressions only; never eval() runtime user input.

Rule source requires an active Pro or Enterprise subscription.
groovy-shell-rce error block

RISK: GroovyShell executes arbitrary Groovy scripts in the JVM process with full server permissions — a leading RCE vector in Jenkins Groovy pipelines (CVE-2019-1003000 class) and Spring Groovy template injection. FIX: Use Groovy's SecureASTCustomizer with a whitelist of allowed classes/methods, or move dynamic logic into a plugin model with a sealed interface.

Rule source requires an active Pro or Enterprise subscription.
groovy-sql-injection error block

RISK: Interpolating Groovy variables directly into SQL strings is SQL injection (CWE-89). GString interpolation makes this easy to miss since it looks like string formatting. FIX: Use parameterized queries: sql.execute('SELECT * FROM users WHERE id = ?', [userId]) — the groovy.sql.Sql class supports positional and named parameters natively.

Rule source requires an active Pro or Enterprise subscription.
groovy-unsafe-deserialization error block

RISK: Java ObjectInputStream deserialization in Groovy is a well-known RCE vector. The Apache Commons Collections gadget chain (CVE-2015-4852) and many successors target Java/Groovy apps. Groovy's dynamic dispatch makes gadget chain exploitation easier than in pure Java. FIX: Use Jackson or Gson with strict type mapping; if deserialization is required, apply JEP 290 ObjectInputFilter to allow only expected classes.

Rule source requires an active Pro or Enterprise subscription.
groovy-weak-crypto warning log

RISK: MD5 and SHA-1 are cryptographically broken and must not be used for security purposes — collision attacks are demonstrated in practice (CWE-327). DES/RC4/RC2 have practical key-recovery attacks. FIX: Use SHA-256 or SHA-3 for hashing; AES-GCM-256 for symmetric encryption; bcrypt/Argon2 for password storage.

Rule source requires an active Pro or Enterprise subscription.

Version metadata

Published metadata

The hash-locked record of this published ruleset. When source contents change, the maintainer resyncs and the version bumps.

Version
v3
Published
Apr 8, 2026
Source commits
0
Synced
Nov 22, 2026
Hash
57dd743922e5a09df98628de38c016f94958702ed5a7de9ed541deb67f82fc69
Signature
Verified (publisher key)
Tested with
claude-code@current
Plan
Starter (free)
Visibility
Public

Source history

Recent commits

Latest commits touching rulesets/rules-groovy/.sigmashake/rules in sigmashakeinc/rules/rulesets/rules-groovy. The published version only bumps when a maintainer resyncs.

No commit history available.