GPT-6.1 Sol · Balanced

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

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

The normal review, with one generalist agent. Judge: Claude Haiku 5.5.

Gold bugs found
2 of 2
Comments published
4
Comments matching a bug
2
Comments not matching
2
Cost of this PR
$1.327

Published comments (4)

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

Overlapping prefix and suffix matching crashes HTML validation — When the sanitizer appends a closing element, overlapping prefix and suffix matches make `substring` throw, preventing the Maven verifier from collecting remaining diagnostics. Bound `end` by each string’s remaining length after subtracting `start`.

mediumbugjs/apps/account-ui/maven-resources/theme/keycloak.v3/account/messages/messages_en.properties:188

Java-format placeholders break multivalued-size errors in both UIs — Users see literal placeholders and ChoiceFormat text because `ThemeResource` returns these strings unchanged and `setUserProfileServerError` uses i18next interpolation. Keep `error-invalid-multivalued-size` compatible with i18next placeholders and supported pluralization in both account and admin UI bundles.

mediumsecuritymisc/theme-verifier/src/main/java/org/keycloak/themeverifier/VerifyMessageProperties.java:124-126

ChoiceFormat normalization hides HTML in translation branches — Unchecked HTML can reach verification emails through `LinkExpirationFormatterMethod`, and the runtime sanitizer permits external HTTPS links. In `VerifyMessageProperties`, preserve and validate HTML inside ChoiceFormat branches, exempting only numeric choice operators instead of replacing entire expressions.

mediumbugthemes/src/main/resources-community/theme/base/login/messages/messages_lt.properties:71

Lithuanian login and account OTP instructions are in Italian — Lithuanian users receive Italian OTP installation instructions from `loginTotpStep1` and the account bundle’s `totpStep1`. Replace both values with Lithuanian instructions while keeping embedded links removed.

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 (0)

None.