GLM-5.3 Flash · Heavy

add-html-sanitizer-for-translated-message-resources-keycloak

Keycloak · Java · M · 100–299 lines · 6 files

The generalist plus 9 specialist lens agents in parallel, then the same verify and dedup steps. Judge: Claude Opus 5.5.

Gold bugs found
2 of 7
Comments published
3
Comments matching a bug
2
Comments not matching
1
Cost of this PR
$0.309

Published comments (3)

mediumbugjs/apps/admin-ui/maven-resources/theme/keycloak.v2/admin/messages/messages_en.properties:3138

JS console uses i18next {{n}} interpolation, but new value uses Java ChoiceFormat — The console renders this value with i18next, which ignores single braces and has no choice format, so users will see raw placeholders instead of the attribute name and counts. Use the `{{n}}` form without the choice, as also needed in the account-ui messages file.

mediumbugmisc/theme-verifier/src/main/java/org/keycloak/themeverifier/VerifyMessageProperties.java:102-111

Common prefix/suffix scans can overlap, causing StringIndexOutOfBoundsException — When the prefix scan overlaps the suffix scan, the `sanitized.substring` and `value.substring` calls throw StringIndexOutOfBoundsException and the verifier crashes instead of reporting the illegal HTML. Clamp `end` so suffix and prefix never overlap, for both strings.

mediumbugmisc/theme-verifier/src/main/java/org/keycloak/themeverifier/VerifyMessageProperties.java:73-80

Uncaught RuntimeException when English reference file is missing or unresolvable — The RuntimeException from reading the English reference escapes `verify()`, aborting the whole run at the first missing file instead of recording a per-file diagnostic. Skip with a message in `messages` when the reference file is missing or unresolvable.

Gold bugs found (2)

mediumThe diff-trimming code computes common prefix and suffix independently, so they can overlap and substring throws StringIndexOutOfBoundsException, crashing the verifier instead of reporting the illegal HTML.
mediumThe account and admin UI bundles now use Java MessageFormat placeholders and choice syntax for error-invalid-multivalued-size, but i18next expects {{n}}, so the UI shows literal {0}/{1}/{2} and the raw choice text.

Gold bugs missed (5)

mediumThe Lithuanian TOTP setup step was replaced with Italian text in both the account and login bundles.
highnormalizeValue blanks the entire choice expression for some keys before HTML validation, so markup placed inside a choice branch of those keys bypasses the new verifier.
mediumThe anchor regex </?a[^>]*> in the theme verifier treats any tag starting with 'a' (<abbr>, <area>, ...) as an anchor tag, which can produce misleading anchor errors or strip such tags before HTML sanitizing.
mediumThe illegalHtmlTag fixture uses a malformed '</div' closing tag, so the sanitizer flags it for malformation and verifyIllegalHtmlTagDetected would still pass if <div> were permitted by POLICY_SOME_HTML; the test does not isolate the forbidden-tag check.
mediumsantizeAnchors removes matching opening anchor tags without checking that the translation keeps the matching closing </a> (or the same number of anchors), so a translation with an unclosed <a ...> passes verification and renders a link that swallows the following content.