You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2026/09/04 07:37:09 UTC

(groovy) branch master updated (c325d77901 -> e9375984eb)

This is an automated email from the ASF dual-hosted git repository.

paulk-asert pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


    from c325d77901 GROOVY-12352: improve consistency of JSON date parsing
     new 056240fb40 monior doc tweak: XmlTemplateEngine javadoc implies escaping; binding values render unescaped
     new e9375984eb monior doc tweak: ConfigSlurper docs can be improved

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 THREAT_MODEL.md                                              |  1 +
 src/main/groovy/groovy/util/ConfigSlurper.groovy             |  8 ++++++++
 .../src/main/groovy/groovy/text/XmlTemplateEngine.java       | 12 +++++++++++-
 3 files changed, 20 insertions(+), 1 deletion(-)


(groovy) 01/02: monior doc tweak: XmlTemplateEngine javadoc implies escaping; binding values render unescaped

Posted by pa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

paulk-asert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 056240fb403ed7bcbdb1c7b68871e93ccc5b348b
Author: Paul King <pa...@asert.com.au>
AuthorDate: Fri Sep 4 16:34:49 2026 +1000

    monior doc tweak: XmlTemplateEngine javadoc implies escaping; binding values render unescaped
---
 .../src/main/groovy/groovy/text/XmlTemplateEngine.java       | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/subprojects/groovy-templates/src/main/groovy/groovy/text/XmlTemplateEngine.java b/subprojects/groovy-templates/src/main/groovy/groovy/text/XmlTemplateEngine.java
index 47ee9bb41d..c6547602b9 100644
--- a/subprojects/groovy-templates/src/main/groovy/groovy/text/XmlTemplateEngine.java
+++ b/subprojects/groovy-templates/src/main/groovy/groovy/text/XmlTemplateEngine.java
@@ -57,9 +57,19 @@ import java.util.concurrent.atomic.AtomicInteger;
  * <p>
  * Comments and processing instructions
  * will be removed as part of processing and special XML characters such as
- * &lt;, &gt;, &quot; and &apos; will be escaped using the respective XML notation.
+ * &lt;, &gt;, &quot; and &apos; <em>in the text of the template</em> will be escaped
+ * using the respective XML notation.
  * The output will also be indented using standard XML pretty printing.
  * <p>
+ * That escaping is applied to the template as it is read, and deliberately not to the
+ * <code>${expression}</code> and <code>$variable</code> insertions, which have to survive
+ * as Groovy for the value to be computed at all. Whatever such an insertion produces is
+ * written as it stands: a value carrying <code>&lt;</code> or <code>&amp;</code> reaches
+ * the output as markup rather than as text, and can leave it neither well-formed nor what
+ * the template intended. Escape a value that may contain either, with
+ * {@link groovy.xml.XmlUtil#escapeXml(String)} or otherwise, before binding it &mdash;
+ * always for a value that came from somewhere you do not control.
+ * <p>
  * The xmlns namespace definition for <code>gsp:</code> tags will be removed
  * but other namespace definitions will be preserved (but may change to an
  * equivalent position within the XML tree).


(groovy) 02/02: monior doc tweak: ConfigSlurper docs can be improved

Posted by pa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

paulk-asert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit e9375984eb6c99e4b7d7017752259203345a5770
Author: Paul King <pa...@asert.com.au>
AuthorDate: Fri Sep 4 16:39:12 2026 +1000

    monior doc tweak: ConfigSlurper docs can be improved
---
 THREAT_MODEL.md                                  | 1 +
 src/main/groovy/groovy/util/ConfigSlurper.groovy | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/THREAT_MODEL.md b/THREAT_MODEL.md
index b0b9cc8293..1c60fc1d62 100644
--- a/THREAT_MODEL.md
+++ b/THREAT_MODEL.md
@@ -546,6 +546,7 @@ Groovy does **not** claim, and you must not assume, any of the following.
 | `@CompileStatic` / `@TypeChecked` | Compile-time type checking for correctness and performance | Not a security control; statically-compiled code is exactly as privileged. |
 | `groovy.sql.Sql` (beyond P1) | Convenience SQL access | Only the GString/bind forms parameterize. A `String` you concatenate yourself, dynamic identifiers via `Sql.expand`, or `DataSet` table/column names, are **not** protected (CWE-89). |
 | The Groovy "shell"/console tools | Developer/operator conveniences | `groovysh`/`groovyConsole` run code with the user's full privileges; they are not multi-tenant or sandboxed. `groovy -l` is the same kind of tool with a socket for an input channel instead of a terminal &mdash; an aid to experimenting with a line-driven script, not an application server. Deploying either as though it were is a choice with consequences ([§10](#10-downstream-responsibilities)). |
+| `ConfigSlurper` | A reader for configuration written as Groovy | The name places it beside `JsonSlurper`, `YamlSlurper` and the rest, which map a document to values. This one compiles and runs what it is handed, so a configuration file is code: `parse` on text from elsewhere is `Eval` under another name, and [§3](#3-out-of-scope-explicit-non-goals) applies to it rather than [§8](#8-security-properties-the-project-provides) P3. |
 | `JmxBuilder` connector servers | A development and experimentation aid | Every connector security property was assembled and discarded from 2008 until 2026, so no configuration produced a secured connector in that window and none can have been relied upon. It exposes an MBean server rather than being a managed service, and authenticates nobody unless told to. |
 
 Well-known attack classes Groovy does **not** defend against on the
diff --git a/src/main/groovy/groovy/util/ConfigSlurper.groovy b/src/main/groovy/groovy/util/ConfigSlurper.groovy
index 76394d905a..263f2f79fb 100644
--- a/src/main/groovy/groovy/util/ConfigSlurper.groovy
+++ b/src/main/groovy/groovy/util/ConfigSlurper.groovy
@@ -36,6 +36,14 @@ import org.codehaus.groovy.runtime.InvokerHelper
  * Settings can either be bound into nested maps or onto a specified JavaBean instance.
  * In the latter case, an error will be thrown if a property cannot be bound.
  *
+ * <p>
+ * The configuration is a Groovy script and reading it runs it. That is what makes the dot
+ * notation and the closures above work, and it also means a configuration file can do
+ * anything the application itself can. Despite the name, this is not one of the data
+ * slurpers: {@link groovy.json.JsonSlurper} and its siblings map a document to values,
+ * whereas {@code parse} here compiles and executes what it is given. Read configuration
+ * only from somewhere you would accept code from.
+ *
  * @since 1.5
  */
 class ConfigSlurper {