Skip to content

Use the registered SAX parser feature names - #16392

Merged
jdaugherty merged 1 commit into
7.0.xfrom
fix/sax-parser-feature-names
Sep 24, 2026
Merged

jdaugherty merged 1 commit into
7.0.xfrom
fix/sax-parser-feature-names

Conversation

@matrei

@matrei matrei commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Summary

SpringIOUtils.createParserFactory() (grails-gradle-model) and the HTTP test client's XmlUtils set their SAX parser features with https://xml.org/... and https://apache.org/... names. The parser only recognises the registered http:// forms, so every setFeature call was rejected with SAXNotRecognizedException and the empty catch swallowed it. Only FEATURE_SECURE_PROCESSING took effect.

Secure processing makes the JDK parser refuse to read external resources, but it does so by throwing. As a result, any document that referenced an external DTD or an external entity failed to parse instead of having the reference skipped. That includes descriptors with a DOCTYPE pointing at a DTD URL (for example the JSP 1.2 TLD form), parsed through createXmlSlurper().

This is the narrow 7.0.x counterpart of the identifier correction in #16331 on 8.0.x. The rest of #16331 (rejecting DOCTYPE by default, the grails.xml.allowDocTypeDeclaration setting, the strict/tolerant parser split and XmlParserFeature) changes behaviour and stays on 8.0.x.

Changes

  • SpringIOUtils and XmlUtils use the registered http:// feature names. Every feature keeps the value 7.0.x already sets:
    • DOCTYPE declarations are still allowed and internal entities still expand.
    • External general entities, external parameter entities and external DTDs are now skipped rather than causing a parse failure.

Testing

  • New SpringIOUtilsSpec in grails-gradle/model, adapted from Fix SAX parser feature URIs and reject DOCTYPE declarations #16331 to 7.0.x behaviour. Five of its eight features fail without the fix, with "External DTD" or "External Entity" parse errors.
  • XmlUtilsSpec and TestHttpResponseSpec expected the old parse error for an external entity; they now check that the file contents are not included. XmlUtilsSpec gains the external parameter entity and external DTD cases. The four updated features fail without the fix.
  • Test results with the fix:
    • :grails-gradle-model:test (57 tests) and :grails-testing-support-http-client:test (106 tests) pass.
    • The SpringIOUtils caller modules pass: grails-converters, grails-core, grails-web-databinding and grails-test-suite-web.
    • Root codeStyle and grails-gradle's :grails-gradle-model:codeStyle pass.

Merge-up note

These files were reworked on 8.0.x by #16331. When 7.0.x is merged up, keep the 8.0.x side for SpringIOUtils.java, XmlUtils.groovy, SpringIOUtilsSpec, XmlUtilsSpec and TestHttpResponseSpec.

SpringIOUtils and the HTTP test client's XmlUtils set their parser
features with https://xml.org/... and https://apache.org/... names.
The parser only recognises the http:// forms, so every setFeature call
was rejected and the exception swallowed, leaving only secure
processing in effect. Documents that reference an external DTD or
external entity then failed to parse instead of having the reference
skipped.

Use the http:// names so the features apply as intended. DOCTYPE
declarations remain allowed.
@testlens-app

testlens-app Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

🚨 TestLens detected 1 failed test 🚨

Here is what you can do:

  1. Inspect the test failures carefully.
  2. If you are convinced that some of the tests are flaky, you can mute them below.
  3. Finally, trigger a rerun by checking the rerun checkbox.

Test Summary

CI / Build Grails Forge (17) > :grails-forge-cli:test [grails-forge]

Test Runs Flakiness
CreateControllerCommandSpec > test app with controller ❌ ❌ 1% 🟡

🏷️ Commit: 6f3ff26
▶️ Tests: 9568 executed
⚪️ Checks: 51/51 completed

Test Failures

CreateControllerCommandSpec > test app with controller (:grails-forge-cli:test [grails-forge] in CI / Build Grails Forge (17))
Condition not satisfied after 240.00 seconds and 239 attempts
	at spock.util.concurrent.PollingConditions.within(PollingConditions.java:185)
	at spock.util.concurrent.PollingConditions.eventually(PollingConditions.java:140)
	at org.grails.forge.cli.CommandSpec.testOutputContains(CommandSpec.groovy:64)
	at org.grails.forge.cli.command.CreateControllerCommandSpec.test app with controller(CreateControllerCommandSpec.groovy:73)
Caused by: Condition not satisfied:

output.toString().contains(value)
|      |          |        |
|      |          false    BUILD SUCCESSFUL
|      To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.14.5/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation.
|      Daemon will be stopped at the end of the build 
|       
|      > Task :assetCompile
|      Starting AssetCompiler [-i, /tmp/grailsforgetmp9951344329809109683/grails-app/assets, -o, /tmp/grailsforgetmp9951344329809109683/build/assets, -j, /home/runner/.gradle/caches/modules-2/files-2.1/org.webjars.npm/bootstrap/5.3.8/1a2f960f569cba04bce1c79ff07ab8985a0f56a0/bootstrap-5.3.8.jar, -j, /home/runner/.gradle/caches/modules-2/files-2.1/org.webjars.npm/bootstrap-icons/1.13.1/add743da3f8acf43906ece5d5fb8b759d2b0eeed/bootstrap-icons-1.13.1.jar, -j, /home/runner/.gradle/caches/modules-2/files-2.1/org.webjars.npm/jquery/3.7.1/abca7c4ab5c6ff5f533f5d7dbc646661c36c8b6b/jquery-3.7.1.jar, -B, eyJjb25maWdPcHRpb25zIjp7fSwiZW5hYmxlRGlnZXN0cyI6dHJ1ZSwiZW5hYmxlR3ppcCI6dHJ1ZSwiZW5hYmxlU291cmNlTWFwcyI6dHJ1ZSwiZXhjbHVkZXNHemlwIjpbXSwibWF4VGhyZWFkcyI6bnVsbCwibWluaWZ5Q3NzIjp0cnVlLCJtaW5pZnlKcyI6dHJ1ZSwic2tpcE5vbkRpZ2VzdHMiOnRydWUsIm1pbmlmeU9wdGlvbnMiOnt9LCJ2ZXJib3NlIjp0cnVlLCJleGNsdWRlcyI6WyJ3ZWJqYXJzL2pxdWVyeS8qKiIsIndlYmphcnMvYm9vdHN0cmFwLyoqIiwid2ViamFycy9ib290c3RyYXAtaWNvbnMvKioiXSwiaW5jbHVkZXMiOlsid2ViamFycy9qcXVlcnkvKi9kaXN0L2pxdWVyeS5qcyIsIndlYmphcnMvYm9vdHN0cmFwLyovZGlzdC9qcy9ib290c3RyYXAuYnVuZGxlLmpzIiwid2ViamFycy9ib290c3RyYXAvKi9kaXN0L2Nzcy9ib290c3RyYXAuY3NzIiwid2ViamFycy9ib290c3RyYXAtaWNvbnMvKi9mb250L2Jvb3RzdHJhcC1pY29ucy5jc3MiLCJ3ZWJqYXJzL2Jvb3RzdHJhcC1pY29ucy8qL2ZvbnQvZm9udHMvKiJdLCJyZXNvbHZlcnMiOltdLCJhc3NldHNQYXRoIjoiL3RtcC9ncmFpbHNmb3JnZXRtcDk5NTEzNDQzMjk4MDkxMDk2ODMvZ3JhaWxzLWFwcC9hc3NldHMiLCJjYWNoZUxvY2F0aW9uIjoiL3RtcC9ncmFpbHNmb3JnZXRtcDk5NTEzNDQzMjk4MDkxMDk2ODMvYnVpbGQvLmFzc2V0Y2FjaGUifQ==]
|      12:22:26.590 [main] INFO asset.pipeline.LoggingAssetEventListener -- Finished Precompiling Assets
|       
|      > Task :compileJava NO-SOURCE
|      > Task :compileGroovy
|      > Task :buildProperties
|      > Task :processResources
|      > Task :classes
|      > Task :compileWebappGroovyPages NO-SOURCE
|      > Task :compileGroovyPages
|      > Task :findMainClass
|      > Task :bootWar
|      > Task :war
|      > Task :assemble
|      > Task :compileTestJava NO-SOURCE
|      > Task :compileTestGroovy
|      > Task :processTestResources NO-SOURCE
|      > Task :testClasses
|      > Task :test
|      > Task :compileIntegrationTestJava NO-SOURCE
|      > Task :compileIntegrationTestGroovy
|      > Task :processIntegrationTestResources
|      > Task :integrationTestClasses
|      > Task :integrationTest
To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.14.5/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation.
Daemon will be stopped at the end of the build 
 
> Task :assetCompile
Starting AssetCompiler [-i, /tmp/grailsforgetmp9951344329809109683/grails-app/assets, -o, /tmp/grailsforgetmp9951344329809109683/build/assets, -j, /home/runner/.gradle/caches/modules-2/files-2.1/org.webjars.npm/bootstrap/5.3.8/1a2f960f569cba04bce1c79ff07ab8985a0f56a0/bootstrap-5.3.8.jar, -j, /home/runner/.gradle/caches/modules-2/files-2.1/org.webjars.npm/bootstrap-icons/1.13.1/add743da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y2FjaGUifQ==]
12:22:26.590 [main] INFO asset.pipeline.LoggingAssetEventListener -- Finished Precompiling Assets
 
> Task :compileJava NO-SOURCE
> Task :compileGroovy
> Task :buildProperties
> Task :processResources
> Task :classes
> Task :compileWebappGroovyPages NO-SOURCE
> Task :compileGroovyPages
> Task :findMainClass
> Task :bootWar
> Task :war
> Task :assemble
> Task :compileTestJava NO-SOURCE
> Task :compileTestGroovy
> Task :processTestResources NO-SOURCE
> Task :testClasses
> Task :test
> Task :compileIntegrationTestJava NO-SOURCE
> Task :compileIntegrationTestGroovy
> Task :processIntegrationTestResources
> Task :integrationTestClasses
> Task :integrationTest

	at org.grails.forge.cli.CommandSpec.testOutputContains_closure1(CommandSpec.groovy:65)
	at org.grails.forge.cli.CommandSpec.testOutputContains_closure1(CommandSpec.groovy)
	at groovy.lang.Closure.call(Closure.java:427)
	at spock.util.concurrent.PollingConditions.within(PollingConditions.java:168)
	... 3 more
CreateControllerCommandSpec > test app with controller (:grails-forge-cli:test [grails-forge] in CI / Build Grails Forge (17) | Attempt 1/2)
Condition not satisfied after 240.00 seconds and 238 attempts
	at spock.util.concurrent.PollingConditions.within(PollingConditions.java:185)
	at spock.util.concurrent.PollingConditions.eventually(PollingConditions.java:140)
	at org.grails.forge.cli.CommandSpec.testOutputContains(CommandSpec.groovy:64)
	at org.grails.forge.cli.command.CreateControllerCommandSpec.test app with controller(CreateControllerCommandSpec.groovy:73)
Caused by: Condition not satisfied:

output.toString().contains(value)
|      |          |        |
|      |          false    BUILD SUCCESSFUL
|      To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.14.5/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation.
|      Daemon will be stopped at the end of the build 
|       
|      > Task :assetCompile
|      Starting AssetCompiler [-i, /tmp/grailsforgetmp3108660478379246697/grails-app/assets, -o, /tmp/grailsforgetmp3108660478379246697/build/assets, -j, /home/runner/.gradle/caches/modules-2/files-2.1/org.webjars.npm/bootstrap/5.3.8/1a2f960f569cba04bce1c79ff07ab8985a0f56a0/bootstrap-5.3.8.jar, -j, /home/runner/.gradle/caches/modules-2/files-2.1/org.webjars.npm/bootstrap-icons/1.13.1/add743da3f8acf43906ece5d5fb8b759d2b0eeed/bootstrap-icons-1.13.1.jar, -j, /home/runner/.gradle/caches/modules-2/files-2.1/org.webjars.npm/jquery/3.7.1/abca7c4ab5c6ff5f533f5d7dbc646661c36c8b6b/jquery-3.7.1.jar, -B, eyJjb25maWdPcHRpb25zIjp7fSwiZW5hYmxlRGlnZXN0cyI6dHJ1ZSwiZW5hYmxlR3ppcCI6dHJ1ZSwiZW5hYmxlU291cmNlTWFwcyI6dHJ1ZSwiZXhjbHVkZXNHemlwIjpbXSwibWF4VGhyZWFkcyI6bnVsbCwibWluaWZ5Q3NzIjp0cnVlLCJtaW5pZnlKcyI6dHJ1ZSwic2tpcE5vbkRpZ2VzdHMiOnRydWUsIm1pbmlmeU9wdGlvbnMiOnt9LCJ2ZXJib3NlIjp0cnVlLCJleGNsdWRlcyI6WyJ3ZWJqYXJzL2pxdWVyeS8qKiIsIndlYmphcnMvYm9vdHN0cmFwLyoqIiwid2ViamFycy9ib290c3RyYXAtaWNvbnMvKioiXSwiaW5jbHVkZXMiOlsid2ViamFycy9qcXVlcnkvKi9kaXN0L2pxdWVyeS5qcyIsIndlYmphcnMvYm9vdHN0cmFwLyovZGlzdC9qcy9ib290c3RyYXAuYnVuZGxlLmpzIiwid2ViamFycy9ib290c3RyYXAvKi9kaXN0L2Nzcy9ib290c3RyYXAuY3NzIiwid2ViamFycy9ib290c3RyYXAtaWNvbnMvKi9mb250L2Jvb3RzdHJhcC1pY29ucy5jc3MiLCJ3ZWJqYXJzL2Jvb3RzdHJhcC1pY29ucy8qL2ZvbnQvZm9udHMvKiJdLCJyZXNvbHZlcnMiOltdLCJhc3NldHNQYXRoIjoiL3RtcC9ncmFpbHNmb3JnZXRtcDMxMDg2NjA0NzgzNzkyNDY2OTcvZ3JhaWxzLWFwcC9hc3NldHMiLCJjYWNoZUxvY2F0aW9uIjoiL3RtcC9ncmFpbHNmb3JnZXRtcDMxMDg2NjA0NzgzNzkyNDY2OTcvYnVpbGQvLmFzc2V0Y2FjaGUifQ==]
|      09:48:33.575 [main] INFO asset.pipeline.LoggingAssetEventListener -- Finished Precompiling Assets
|       
|      > Task :compileJava NO-SOURCE
|      > Task :compileGroovy
|      > Task :buildProperties
|      > Task :processResources
|      > Task :classes
|      > Task :compileWebappGroovyPages NO-SOURCE
|      > Task :compileGroovyPages
|      > Task :findMainClass
|      > Task :bootWar
|      > Task :war
|      > Task :assemble
|      > Task :compileTestJava NO-SOURCE
|      > Task :compileTestGroovy
|      > Task :processTestResources NO-SOURCE
|      > Task :testClasses
|      > Task :test
|      > Task :compileIntegrationTestJava NO-SOURCE
|      > Task :compileIntegrationTestGroovy
|      > Task :processIntegrationTestResources
|      > Task :integrationTestClasses
|      > Task :integrationTest
To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.14.5/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation.
Daemon will be stopped at the end of the build 
 
> Task :assetCompile
Starting AssetCompiler [-i, /tmp/grailsforgetmp3108660478379246697/grails-app/assets, -o, /tmp/grailsforgetmp3108660478379246697/build/assets, -j, /home/runner/.gradle/caches/modules-2/files-2.1/org.webjars.npm/bootstrap/5.3.8/1a2f960f569cba04bce1c79ff07ab8985a0f56a0/bootstrap-5.3.8.jar, -j, /home/runner/.gradle/caches/modules-2/files-2.1/org.webjars.npm/bootstrap-icons/1.13.1/add743da3f8acf43906ece5d5fb8b759d2b0eeed/bootstrap-icons-1.13.1.jar, -j, /home/runner/.gradle/caches/modules-2/files-2.1/org.webjars.npm/jquery/3.7.1/abca7c4ab5c6ff5f533f5d7dbc646661c36c8b6b/jquery-3.7.1.jar, -B, eyJjb25maWdPcHRpb25zIjp7fSwiZW5hYmxlRGlnZXN0cyI6dHJ1ZSwiZW5hYmxlR3ppcCI6dHJ1ZSwiZW5hYmxlU291cmNlTWFwcyI6dHJ1ZSwiZXhjbHVkZXNHemlwIjpbXSwibWF4VGhyZWFkcyI6bnVsbCwibWluaWZ5Q3NzIjp0cnVlLCJtaW5pZnlKcyI6dHJ1ZSwic2tpcE5vbkRpZ2VzdHMiOnRydWUsIm1pbmlmeU9wdGlvbnMiOnt9LCJ2ZXJib3NlIjp0cnVlLCJleGNsdWRlcyI6WyJ3ZWJqYXJzL2pxdWVyeS8qKiIsIndlYmphcnMvYm9vdHN0cmFwLyoqIiwid2ViamFycy9ib290c3RyYXAtaWNvbnMvKioiXSwiaW5jbHVkZXMiOlsid2ViamFycy9qcXVlcnkvKi9kaXN0L2pxdWVyeS5qcyIsIndlYmphcnMvYm9vdHN0cmFwLyovZGlzdC9qcy9ib290c3RyYXAuYnVuZGxlLmpzIiwid2ViamFycy9ib290c3RyYXAvKi9kaXN0L2Nzcy9ib290c3RyYXAuY3NzIiwid2ViamFycy9ib290c3RyYXAtaWNvbnMvKi9mb250L2Jvb3RzdHJhcC1pY29ucy5jc3MiLCJ3ZWJqYXJzL2Jvb3RzdHJhcC1pY29ucy8qL2ZvbnQvZm9udHMvKiJdLCJyZXNvbHZlcnMiOltdLCJhc3NldHNQYXRoIjoiL3RtcC9ncmFpbHNmb3JnZXRtcDMxMDg2NjA0NzgzNzkyNDY2OTcvZ3JhaWxzLWFwcC9hc3NldHMiLCJjYWNoZUxvY2F0aW9uIjoiL3RtcC9ncmFpbHNmb3JnZXRtcDMxMDg2NjA0NzgzNzkyNDY2OTcvYnVpbGQvLmFzc2V0Y2FjaGUifQ==]
09:48:33.575 [main] INFO asset.pipeline.LoggingAssetEventListener -- Finished Precompiling Assets
 
> Task :compileJava NO-SOURCE
> Task :compileGroovy
> Task :buildProperties
> Task :processResources
> Task :classes
> Task :compileWebappGroovyPages NO-SOURCE
> Task :compileGroovyPages
> Task :findMainClass
> Task :bootWar
> Task :war
> Task :assemble
> Task :compileTestJava NO-SOURCE
> Task :compileTestGroovy
> Task :processTestResources NO-SOURCE
> Task :testClasses
> Task :test
> Task :compileIntegrationTestJava NO-SOURCE
> Task :compileIntegrationTestGroovy
> Task :processIntegrationTestResources
> Task :integrationTestClasses
> Task :integrationTest

	at org.grails.forge.cli.CommandSpec.testOutputContains_closure1(CommandSpec.groovy:65)
	at org.grails.forge.cli.CommandSpec.testOutputContains_closure1(CommandSpec.groovy)
	at groovy.lang.Closure.call(Closure.java:427)
	at spock.util.concurrent.PollingConditions.within(PollingConditions.java:168)
	... 3 more

Rerun Controls

Select tests to mute in this pull request:

  • CreateControllerCommandSpec > test app with controller

Reuse successful test results:

  • ♻️ Only rerun the tests that failed or were muted before

Click the checkbox to trigger a rerun:

  • Rerun jobs

Learn more about TestLens at testlens.app/docs.

@jdaugherty jdaugherty left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We added an enum for the feature names in 8.x, can we backport that same enum in 7.x?

@matrei

matrei commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

I kept this to the literal fix on purpose. Backporting XmlParserFeature would add a new public type to grails-gradle-common and a new published dependency from grails-gradle-model and grails-testing-support-http-client in a patch release. The enum arrives on 7.0.x's successors through the merge-up anyway: the merge-up note keeps the 8.0.x side of both files. The new SpringIOUtilsSpec and XmlUtilsSpec features check parsing behaviour rather than the identifier strings, so a later https rewrite on 7.0.x would fail those tests.

@jdaugherty
jdaugherty merged commit 4e3d0c2 into 7.0.x Sep 24, 2026
93 of 95 checks passed
@jdaugherty
jdaugherty deleted the fix/sax-parser-feature-names branch September 24, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants