Lukasz Lenart created WW-5824:
---------------------------------
Summary: Radio tag renders its name attribute without HTML
escaping, unlike every other form tag
Key: WW-5824
URL: https://issues.apache.org/jira/browse/WW-5824
Project: Struts 2
Issue Type: Bug
Components: Core Tags
Reporter: Lukasz Lenart
Fix For: 7.5.0
The radio template is the only bundled form template that writes the {{name}}
attribute with {{?no_esc}}. Every sibling template (checkbox, checkboxlist,
text, select, file, hidden, password, textarea, submit, reset, form) writes it
under the FreeMarker auto-escaping configured for the UI templates, and the
javatemplates plugin escapes it as well.
The exception dates from the original template, which never carried the
per-parameter {{?html}} the checkbox template had. When the templates moved to
built-in auto-escaping in WW-4972, the radio template kept its previous output
by adding {{?no_esc}} to that one attribute.
h2. Current behaviour
A radio with a name containing a double quote, rendered under the {{simple}},
{{xhtml}} or {{html5}} theme, closes the attribute early:
{code}<input type="radio" name="x" onfocus="alert(1)"
id="x__onfocus__alert_1_a" value="a"/>
{code}
A checkboxlist with the same name renders the quote as {{"}}.
h2. Expected behaviour
The radio name is written the same way as on every other tag, HTML-escaped.
h2. Change
Remove {{?no_esc}} from the {{name}} attribute in the {{simple}} and {{html5}}
radio templates and pin the escaped output with a test. One existing fixture,
Radio-6.txt, pins a name containing apostrophes; auto-escaping renders those as
{{'}}, as the combobox fixtures already show.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)