Skip to content

[FREEMARKER-237] Never downgrade the "force" auto-escaping policy. - #141

Merged
ddekany merged 2 commits into
apache:2.3-gaefrom
nolaviz:FREEMARKER-237
Nov 21, 2026
Merged

ddekany merged 2 commits into
apache:2.3-gaefrom
nolaviz:FREEMARKER-237

Conversation

@nolaviz

@nolaviz nolaviz commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

The autoesc directive and the auto_esc=true header parameter used to overwrite the parser's auto-escaping policy with "enable_if_supported". The parse-time bans of the "force" policy (the no_esc built-in and the noautoesc directive) compare that same field against "force", so they stopped firing inside an autoesc block and after an auto_esc=true header. For example, with "force" set, this template printed x unescaped instead of failing to parse:

<#autoesc>${x?no_esc}</#autoesc>

Keep "force" when it is already the current policy. Auto-escaping stays enabled either way, so templates that only use autoesc / auto_esc=true are unaffected.

The autoesc directive and the auto_esc=true header parameter used to overwrite
the parser's auto-escaping policy with "enable_if_supported". The parse-time
bans of the "force" policy (the no_esc built-in and the noautoesc directive)
compare that same field against "force", so they stopped firing inside an
autoesc block and after an auto_esc=true header. For example, with "force" set,
this template printed x unescaped instead of failing to parse:

    <#autoesc>${x?no_esc}</#autoesc>

Keep "force" when it is already the current policy. Auto-escaping stays enabled
either way, so templates that only use autoesc / auto_esc=true are unaffected.
@nolaviz nolaviz changed the title Never downgrade the "force" auto-escaping policy. [FREEMARKER-237] Never downgrade the "force" auto-escaping policy. Nov 19, 2026
@ddekany
ddekany merged commit 7b3e4b2 into apache:2.3-gae Nov 21, 2026
@ddekany

ddekany commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Thanks, resovled with follow up test and manual update commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants