This is an automated email from the ASF dual-hosted git repository.
dashorst pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git
The following commit(s) were added to refs/heads/master by this push:
new d89aabe91a Say in SECURITY.md that a bundle value is escaped for the
context it is written into
d89aabe91a is described below
commit d89aabe91a7af2d0d9401d768989a44cbdffcdf0
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.
Co-Authored-By: Claude Mythos 5.1 <[email protected]>
---
SECURITY.md | 35 ++++++++++++++++++++++-------------
1 file changed, 22 insertions(+), 13 deletions(-)
diff --git a/SECURITY.md b/SECURITY.md
index 4686868d9e..bfd2f3a3df 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -366,7 +366,7 @@ serialized Wicket data, remains trusted storage. And a
custom `ICryptScheme`
inherits the guarantee only if it honours the contract: `decrypt` must return
`null` on authentication failure rather than returning unverified plaintext.
-### 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
@@ -384,18 +384,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