Repository navigation
Reduce unnecessary JavaScript letter escaping while preserving boundary safety - #247
Merged
Merged
Conversation
arpadf78
reviewed
Oct 17, 2026
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, including the latest comment about whitespace and escaping
<.forJavaScriptandforJavaScriptBlockleave interior script-name letters readable and escape such a letter only when it is the final input character. Punctuation and whitespace escapes remain.http://google.comhttp:\/\/google.comscriptscrip\x74csriptcsrip\x74i\x69scripturescriptureHTML does not remove whitespace inside tag names. Escaping
<addresses the HTML tag delimiter concern for a complete encoded string, alongside necessary JavaScript escapes. It cannot protect a fragment whose trusted prefix supplies<. The terminal escape retains the documented fragment protection. This rule is conservative, not minimal;csriptandcatstill receive a terminal escape. Attribute-only and source modes are unchanged.Streaming retains one undecidable trailing letter.
EncodedWriter.flush()safely emits a pending script letter or high surrogate before flushing the wrapped writer. Explicit flushes can add escapes while preserving JavaScript UTF-16 values; ordinary chunking remains byte-identical to whole-value encoding. General/block callers must flush before writing directly to the wrapped writer. Low-level callers must retain unread input after UNDERFLOW and supply more input or mark end-of-input.Compatibility
No public API, Java 8 requirement, dependency, module, bundle, or servlet-namespace change. Emitted bytes change, and the guarantee is refined from prohibiting literal
</scriptsubstrings to preventing recognized HTML tokens. Longer names such as</scripture>remain harmless. Existing insertion preconditions apply. Review snapshots, signatures, and cache keys. Recommend 1.6.0; this PR retains the development version and does not publish a release.Validation and review
Final revision:
da8b7a0d298c952aee9064f67dec75e0ab16a32f.<escaping and fragment composition.Jim Manico explicitly authorized the existing audit-visible PR-only review bypass for this PR after review and required CI success. No required CI/security control is bypassed. Release signing and publication remain separate gates.