Repository navigation
Conversation
arpadf78
reviewed
Oct 17, 2026
| /** | ||
| * Whether the ASCII character can continue a case-insensitive script name. | ||
| */ | ||
| private static boolean isScriptNameLetter(char ch) { |
There was a problem hiding this comment.
Because it looks chars in isolation, this probably cannot distinguish "script" from "csript".
This branch has not been deployed
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.
Change
Addresses #243, especially the reopening comment.
forJavaScriptandforJavaScriptBlockcurrently escape every occurrence of a script-name letter, unnecessarily obscuring ordinary text. This change leaves interior letters readable and escapes a script-name letter only at the end of the encoded value. Existing punctuation and whitespace escapes remain.Examples of complete-value output:
http://google.comhttp:\/\/google.comscriptscrip\x74i\x69scripturescriptureThe terminal escape retains protection when a tag name is split across trusted text and encoded input. The rule is conservative, not minimal:
catstill becomesca\x74. Attribute-only and standalone-source modes are unchanged.Streaming retains an undecidable trailing letter.
EncodedWriter.flush()safely emits a pending script letter or high surrogate before flushing the wrapped writer, preserving barriers before subsequent trusted output. Explicit flushes can add escapes while preserving JavaScript UTF-16 values; ordinary write chunking remains byte-identical to whole-value encoding.Draft for @arpadf78 to review. Please keep this unmerged and unreleased pending the reporter's feedback. This PR does not close the issue automatically or authorize a release.
Compatibility and validation
No public API or dependency changes. Encoded bytes change, and the guarantee is narrowed from prohibiting every literal
</scriptsubstring to preventing recognized HTML tokens. Longer names such as</scripture>remain harmless. Existing insertion-boundary restrictions still apply. Documentation, Javadocs, TLDs and the changelog describe these changes. A future minor release is recommended; the development version is unchanged.Low-level
Encoder.encodecallers must preserve unread lookahead and supply more input or mark end-of-input. Retrying unchanged nonfinal input can spin; custom streaming adapters must finish pending input before writing trusted suffixes.Validation on the proposed tree:
./mvnw -B -ntp clean verifypassed, including 1,866 core tests, 218 tests per JSP adapter, coverage/style/Javadoc/API checks, OSGi/JPMS checks and both packaged JSP engine fixtures../mvnw -B -ntp -PtestJakarta -Dtest=JavaScriptTemplateTest -Dsurefire.failIfNoSpecifiedTests=false -Dencoder.browser.local=true testpassed all 12 tests. Added matrices cover 355,372 fixtures, including 75,376 unsafe controls and 324 live iframe pages with 24 executed-injection controls.Java 8 runtime execution and the full Docker/WAR release gate were not run locally. Browser execution was tested in Chrome, not every engine. Those release checks remain separate from this review.