Repository navigation
Make the XML-safe HTML encoder the default for grails.views.gsp.htmlcodec - #16460
Merged
Merged
Conversation
…odec When grails.views.gsp.htmlcodec was not set, HTMLCodec used the HTML4 encoder from before Grails 2.3, although every application generated since then has set htmlcodec: xml. Only applications without the setting got the HTML4 encoder, which writes non-ASCII characters as named entities and leaves @, the backslash, the backtick and U+2028/ U+2029 unescaped. Use HTMLEncoder by default. The value html4 (or html, which selected the HTML4 encoder before) opts back in to the HTML4 encoder; xml, xhtml and any other value select the default. The application generator and the web profile skeleton no longer write htmlcodec: xml. The codecs and XSS prevention guide sections, the configuration metadata, the Grails 8 upgrade guide and the upgrade skill describe the new default. Fixes #16459
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 8.0.x #16460 +/- ##
==================================================
- Coverage 58.9274% 58.9270% -0.0004%
- Complexity 24440 24443 +3
==================================================
Files 2174 2174
Lines 107366 107365 -1
Branches 19557 19557
==================================================
- Hits 63268 63267 -1
+ Misses 35235 35233 -2
- Partials 8863 8865 +2
🚀 New features to boost your workflow:
|
✅ All tests passed ✅🏷️ Commit: aa0467c Learn more about TestLens at testlens.app/docs. |
jdaugherty
approved these changes
Oct 1, 2026
jdaugherty
left a comment
Contributor
There was a problem hiding this comment.
This isn't really a bug fix, but a feature. I agree the default should probably be changed, but it is a behavior change. We didn't want to do an RC3, and we said we wouldn't do behavior changes for 8.0.0 I think I'm ultimately ok with it, but I'd like to see another person sign off on this to merge.
sbglasius
approved these changes
Oct 2, 2026
antobinary
added a commit
to antobinary/bigbluebutton
that referenced
this pull request
Oct 5, 2026
Apache Grails tagged 8.0.0 on 2026-10-04 and opened its release vote the same day. Until the vote closes the artifacts are in the ASF staging group only, so the TEMP staging-repository entries in build.gradle stay and their comments are retargeted at 8.0.0; they come out once 8.0.0 is on Maven Central. Against RC2 the 8.0.0 BOM changes two things: asset-pipeline goes from 5.2.0-RC3 to 5.2.0 and SiteMesh from 3.3.0-RC3 to 3.3.0. Spring Boot (4.1.1), Groovy (5.1.3) and the Gradle version Grails builds with (9.8.0) are unchanged, so gradle.properties only moves grailsVersion and the cloud.wondrify asset-pipeline plugin follows the BOM to 5.2.0. The Tomcat 11.0.26 override stays: there is still no Spring Boot 4.1 release newer than 4.1.1. .gitlab-ci.yml moves to bbb-build:grails-8--2026-10-04-230216, which has the same toolchain as the previous grails-8 image (JDK 21.0.12.1, Go 1.27.0, Node 22.23.2) with the Grails 8.0.0 CLI. Checked, nothing to do for what went into 8.0.0 after RC2: the default dataSource bean (apache/grails-core#16458) is registered only with GORM for Hibernate, which bbb-web does not ship; the XML-safe GSP html codec default (apache/grails-core#16460) is what bbb-web already configures explicitly, and it has no GSPs; the messageSource basename ordering (apache/grails-core#14753) has nothing to act on, bbb-web looks up no messages through it. Verified with a package build in the new image, installed on a 4.0 dev container: the WAR has the same 248 jars as the RC2 build, with the 44 grails-* jars at 8.0.0 and Spring Boot 4.1.1, Tomcat 11.0.26 and Groovy 5.1.3 unchanged. bbb-web started in 7.4 s with a clean log (no ERROR, only the logback layout/encoder WARNs the stock build prints too) and /bigbluebutton/api returned SUCCESS. A 5.3 MB PDF uploaded through the client became the current presentation (bbb-web counted 117 pages), and a join inside a cross-origin iframe still rendered the client. The api + presentation Playwright suites gave 32 passed, 7 failed and 3 skipped on the 8.0.0 build, the same counts as the stock Grails 7.0.12 build on the same container, and the per-test results were identical: no test differed, the same 7 tests fail on both builds.
Merged
26 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #16459.
When
grails.views.gsp.htmlcodecis not set,HTMLCodecused the HTML4 encoder from before Grails 2.3. Every application template since 2.3 has sethtmlcodec: xml, so only applications without the setting got it. This PR makes the XML-safeHTMLEncoderthe default and keeps the HTML4 encoder as an explicit opt-in.Changes
HTMLCodecusesHTMLEncoderby default.htmlcodec: html4selects the HTML4 encoder.htmlalso selects it, because an application that sethtmlexplicitly got the HTML4 encoder before.xml,xhtmland any other value select the default. Matching ignores case, as before.GrailsGsp) and the web profile skeleton no longer writehtmlcodec: xml.grails.views.gsp.htmlcodecin thegrails-gspconfiguration metadata now describes the new default andhtml4.html4as the opt-out. The out-of-date note saying apostrophes are not escaped is removed, since both encoders escape'as'.htmlcodec: xml.grails-8-upgradeskill.The
htmlcodec: xmllines ingrails-test-examplesand in the pluginapplication.ymlfiles are left as they are. They select the same encoder as before.Compatibility
Applications that set
htmlcodec: xmlare not affected. Applications without the setting now get the XML-safe output: non-ASCII letters are no longer written as named entities, and@,\and`are escaped. Tests that compare escaped markup exactly may need updating, as the twograils-fieldsspecs in this PR did (pattern="\d+"is now rendered aspattern="\d+", which the browser decodes to the same value). Applications that serve pages in a non-UTF-8 charset and rely on the entities can sethtmlcodec: html4.Tests
HTMLCodecTests: the default with and without aGrailsApplication; the settings that select each encoder (xml,XML,xhtml,XHTML,xml-safe, empty and unknown values;html4,HTML4,html,HTML);setUseLegacyEncoder; and that both encoders report theHTMLcodec identifier. Each case checks@,\,`, U+2028 and a non-ASCII letter.CodecsConfigurationSpec: a data-driven feature that resolves theHTMLencoder throughCodecLookupin a Spring context for an unset value,xml,xhtmlandhtml4. The unset row fails without the change.GrailsGspSpec(Forge): the generated configuration no longer containsgrails.views.gsp.htmlcodec.DefaultInputRenderingSpecandDefaultInputRenderingPersistentSpec(grails-fields): the expectedpatternattribute is now the escaped value.The test suites of the modules that render through the HTML codec pass, including
grails-codecs,grails-gsp, the taglib, layout and SiteMesh 3 modules,grails-test-suite-uber/-web/-persistence,grails-fields,grails-scaffolding, the Spring Security plugins,grails-mailandgrails-data-graphql.GrailsGspSpecingrails-forgealso passes.