MiniMax M3 · 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
0 of 2
Comments published
4
Comments matching a bug
0
Comments not matching
4
Cost of this PR
$0.311

Published comments (4)

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

ANCHOR_PATTERN matches any tag starting with 'a', not only anchor tags — Tighten it to `</?a(\s|>|/>)` so only real `<a>`/`</a>` tokens match.

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

verifySafeHtml throws RuntimeException for English file, bypassing Mojo error handling — A missing English file in `verifySafeHtml` aborts the Maven build with an unhandled stack trace because `verify` only catches `IOException`. Throw `MojoExecutionException` so the failure flows through `ThemeVerifierMojo.execute`'s normal validation channel.

mediumbugmisc/theme-verifier/src/main/java/org/keycloak/themeverifier/VerifyMessageProperties.java:150-162

santizeAnchors reports a failure but caller still adds an overlapping illegal-HTML message — When `santizeAnchors` flags an anchor mismatch, `verifySafeHtml` still sanitizes the same string, so each bad key produces two overlapping messages ('Didn't find anchor…' and 'Illegal HTML in key…'). Have `santizeAnchors` signal failure (e.g. return null) so the caller skips the redundant sanitize.

mediumbugmisc/theme-verifier/src/main/java/org/keycloak/themeverifier/VerifyMessageProperties.java:150-162

santizeAnchors strips a stale match because the matcher is anchored to the original value — In `santizeAnchors`, the matcher stays bound to the original `value` while `replaceFirst` mutates it, so the substring stripped is no longer the one just visited. Rebuild the matcher each iteration, or collect anchors first and apply them on a fresh pass.

Gold bugs found (0)

None.

Gold bugs missed (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.