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

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


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

commit 65540440c4defa90783a494678e54ff642701a50
Author: Pedro Santos <[email protected]>
AuthorDate: Wed Oct 14 21:26:27 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 fd3239f80a..9beac5f62d 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -253,7 +253,7 @@ at must therefore be storage only the application itself 
can read and write.
 The encrypted page store, and the trust statement that goes with it, exist on
 9.x and 10.x only.
 
-### 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
@@ -271,18 +271,27 @@ into an attribute, which is escaped when the tag is 
written and would otherwise
 be encoded twice; that is an implementation detail of those components and not 
an
 invitation to render untrusted markup through them.
 
-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
@@ -298,9 +307,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