This is an automated email from the ASF dual-hosted git repository.

dashorst pushed a commit to branch wicket-10.x
in repository https://gitbox.apache.org/repos/asf/wicket.git


The following commit(s) were added to refs/heads/wicket-10.x by this push:
     new f9c5178230 Say in SECURITY.md that a bundle value is escaped for the 
context it is written into
f9c5178230 is described below

commit f9c51782307b57269edfaf02f3b045d14c26fff2
Author: Pedro Santos <[email protected]>
AuthorDate: Wed Oct 14 21:26:26 2026 -0300

    Say in SECURITY.md that a bundle value is escaped for the context it is 
written into
    
    The security model listed message bundles next to markup files as a trusted
    input, with escaping as something a message opts into. A bundle value is not
    markup: a property file does not say whether its value will be written into
    element text, an attribute or a JavaScript literal, so the code that writes
    it escapes it for that context, as the form's hidden fields and the upload
    progress bar now do. The section says so, and keeps wicket:message as the 
one
    place a bundle value is rendered as markup, by the markup author's choice.
    
    Markup files remain the only trusted input. Everything else Wicket writes is
    escaped by the code that writes it, whichever of them the value came from.
    The closing sentence of the section, which said Wicket never escapes for a
    JavaScript context, takes the wording master already has.
    
    Co-Authored-By: Claude Mythos 5.1 <[email protected]>
---
 SECURITY.md | 41 +++++++++++++++++++++++++----------------
 1 file changed, 25 insertions(+), 16 deletions(-)

diff --git a/SECURITY.md b/SECURITY.md
index 7f7c799418..a23fb4724d 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -240,7 +240,7 @@ protected against modification depends entirely on the 
implementation in use,
 and the default implementation is not authenticated. Consult the javadoc of the
 `ICrypter` you configure and rely on no more than it states.
 
-### Model data is escaped; markup and message bundles are trusted
+### Model data and bundle values are escaped; markup is trusted
 
 Wicket escapes the text a component renders from its model. `Component`'s
 `escapeModelStrings` flag is **on by default**, and a component renders
@@ -258,18 +258,27 @@ attribute, which is escaped when the tag is written and 
would otherwise be
 encoded twice; that is an implementation detail of the component and not an
 invitation to render untrusted markup through it.
 
-Two inputs on the other side of the boundary are trusted, because both are
-authored by the developer and neither is data the application received at
-runtime:
-
-- **Markup files are trusted.** A `.html` file on the classpath is a template,
-  exactly like a JSP or a Thymeleaf template, and Wicket renders it as markup. 
An
-  application that serves markup from somewhere an untrusted party can write —
-  through a custom `IMarkupResourceStreamProvider`, for instance — has taken
-  that trust on itself.
-- **Message bundles are trusted.** `<wicket:message key="…"/>` renders its
-  property value as markup by default, and `escape="true"` opts in to escaping.
-  Markup in a bundle is therefore a supported way to format a message.
+**Markup files are trusted.** They sit on the other side of the boundary 
because
+they are authored by the developer and are not data the application received at
+runtime. A `.html` file on the classpath is a template, exactly like a JSP or a
+Thymeleaf template, and Wicket renders it as markup. An application that serves
+markup from somewhere an untrusted party can write — through a custom
+`IMarkupResourceStreamProvider`, for instance — has taken that trust on itself.
+
+**Message bundles are values, not markup.** A bundle is authored by the 
developer
+too, but a property file says nothing about where its value will be written: 
the
+same key can end up in element text, in an attribute, or in a string literal in
+the JavaScript Wicket generates, and an application that overrides one of
+Wicket's own keys — the css class of a form's hidden fields, the starting text 
of
+an upload progress bar — does not get to choose the context. So the code that
+writes a bundle value escapes it for the context it writes it into,
+`Strings#escapeMarkup` for markup and `JavaScriptUtils#escapeQuotes` for a
+JavaScript literal, and a framework component that writes one as it stands is a
+bug in the framework. The one place Wicket itself renders a bundle value as 
markup
+is `<wicket:message key="…"/>`, and there it is the markup author's choice: 
the tag
+renders its property value as markup by default, and `escape="true"` opts in to
+escaping. Markup in a bundle is therefore a supported way to format a message
+there, and only there.
 
 The value a bundle string interpolates is a different matter. `${name}` in a
 message resolves first to a child component with `wicket:id="name"`, whose
@@ -285,9 +294,9 @@ Finally, `Strings#escapeMarkup` escapes `<`, `>`, `&`, `"` 
and `'`. That is
 enough for element text and for a quoted attribute value, and it is not enough
 for anything else: it does not make a value safe inside `<script>` or 
`<style>`,
 in an unquoted attribute, or in a URL where the scheme itself is the payload.
-Wicket does not escape for a JavaScript context anywhere, so a value the
-application places in one — through `TextTemplate` variable substitution, for
-example — has to be encoded by the application.
+Wicket does not automatically escape a value the application places into a
+JavaScript context — through `TextTemplate` variable substitution, for example 
—
+so the application has to encode it.
 
 ### Another origin may not invoke a listener
 

Reply via email to