Skip to content

Add HTML sanitizer for translated message resources - #4

Open
ShashankFC wants to merge 1 commit into
feature-html-sanitizer-baselinefrom
feature-html-sanitizer-implementation
Open

Add HTML sanitizer for translated message resources#4
ShashankFC wants to merge 1 commit into
feature-html-sanitizer-baselinefrom
feature-html-sanitizer-implementation

Conversation

@ShashankFC

Copy link
Copy Markdown
Contributor

Test 7

Summary by CodeRabbit

Release Notes

  • New Features

    • Added recovery codes display and management localization
    • Introduced attribute translation management interface
    • Added logout token configuration settings
  • Improvements

    • Updated TOTP setup guidance across multiple languages
    • Fixed HTML formatting issues in email notifications and authentication error messages
    • Enhanced validation messages with context-aware pluralization

✏️ Tip: You can customize this high-level summary in your review settings.


Replicated from ai-code-review-evaluation/keycloak-coderabbit#7

Closes #37428

Signed-off-by: Alexander Schwartz <alexander.schwartz@gmx.net>
@ShashankFC
ShashankFC requested a review from Copilot January 30, 2026 10:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request addresses HTML sanitization in translated message resources and improves validation message formatting across multiple languages. The changes focus on removing unsafe HTML tags from translations, fixing malformed HTML in email templates, and enhancing pluralization support for attribute validation messages.

Changes:

  • Updated attribute validation error messages to use context-aware pluralization (value vs. values)
  • Fixed HTML formatting issues by removing bold tags and closing missing paragraph tags in email templates
  • Removed hardcoded application references in TOTP setup instructions across multiple language files
  • Added HTML sanitization verification infrastructure with OWASP Java HTML Sanitizer

Reviewed changes

Copilot reviewed 26 out of 48 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
themes/src/main/resources/theme/base/login/messages/messages_en.properties Updated multivalued attribute error message with proper pluralization
themes/src/main/resources/theme/base/admin/messages/messages_en.properties Updated multivalued attribute error message with proper pluralization
themes/src/main/resources-community/theme/base/login/messages/messages_sv.properties Removed HTML tags from TOTP setup instructions
themes/src/main/resources-community/theme/base/login/messages/messages_sk.properties Fixed HTML closing tag and removed hardcoded app references
themes/src/main/resources-community/theme/base/login/messages/messages_no.properties Removed hardcoded app references from TOTP instructions
themes/src/main/resources-community/theme/base/login/messages/messages_lt.properties Contains Italian text in Lithuanian file for TOTP instructions
themes/src/main/resources-community/theme/base/email/messages/messages_no.properties Removed bold HTML tags from email body text
themes/src/main/resources-community/theme/base/email/messages/messages_nl.properties Fixed missing closing paragraph tag
themes/src/main/resources-community/theme/base/email/messages/messages_lt.properties Fixed malformed href attributes in email HTML
themes/src/main/resources-community/theme/base/email/messages/messages_hu.properties Removed asterisk prefix from property key
themes/src/main/resources-community/theme/base/email/messages/messages_da.properties Added missing closing paragraph tag
themes/src/main/resources-community/theme/base/account/messages/messages_zh_CN.properties Contains mixed Chinese/Italian text for TOTP instructions
themes/src/main/resources-community/theme/base/account/messages/messages_sv.properties Removed hardcoded app references from TOTP instructions
themes/src/main/resources-community/theme/base/account/messages/messages_sk.properties Removed hardcoded app references from TOTP instructions
themes/src/main/resources-community/theme/base/account/messages/messages_lt.properties Contains Italian text in Lithuanian file for TOTP instructions
themes/src/main/resources-community/theme/base/account/messages/messages_fi.properties Removed hardcoded app references from TOTP instructions
misc/theme-verifier/src/test/resources/*.properties Added test fixtures for HTML sanitization verification
misc/theme-verifier/src/test/java/org/keycloak/themeverifier/VerifyMessagePropertiesTest.java Added test cases for HTML sanitization verification
misc/theme-verifier/src/main/java/org/keycloak/themeverifier/VerifyMessageProperties.java Implemented HTML sanitization verification logic
misc/theme-verifier/pom.xml Added OWASP HTML Sanitizer and Apache Commons Text dependencies
js/apps/admin-ui/maven-resources/theme/keycloak.v2/admin/messages/messages_en.properties Updated message format from double braces to single braces with pluralization
js/apps/account-ui/maven-resources/theme/keycloak.v3/account/messages/messages_en.properties Updated message format from double braces to single braces with pluralization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

gssDelegationCredential=GSS prisijungimo duomenų delegavimas

loginTotpStep1=Įdiekite <a href="https://freeotp.github.io/" target="_blank">FreeOTP</a> arba Google Authenticator savo įrenginyje. Programėlės prieinamos <a href="https://play.google.com">Google Play</a> ir Apple App Store.
loginTotpStep1=Installa una delle seguenti applicazioni sul tuo cellulare:

Copilot AI Jan 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This translation appears to be in Italian ('Installa una delle seguenti applicazioni sul tuo cellulare') in a Lithuanian (lt) properties file. The translation should be in Lithuanian to match the file's locale.

Suggested change
loginTotpStep1=Installa una delle seguenti applicazioni sul tuo cellulare:
loginTotpStep1=Įdiekite vieną iš šių programėlių į savo mobilųjį telefoną:

Copilot uses AI. Check for mistakes.
configureAuthenticators=配置的认证者
mobile=手机
totpStep1=在你的设备上安装 <a href="https://fedorahosted.org/freeotp/" target="_blank">FreeOTP</a> 或者 Google Authenticator.两个应用可以从 <a href="https://play.google.com">Google Play</a> 和 Apple App Store下载。
totpStep1=在您的手機上安裝以下應用程式之一:

Copilot AI Jan 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This translation appears to use Traditional Chinese characters (手機, 應用程式) in a Simplified Chinese (zh_CN) properties file. Simplified Chinese should use: '在您的手机上安装以下应用程序之一:'

Suggested change
totpStep1=在您的手機上安裝以下應用程式之一
totpStep1=在您的手机上安装以下应用程序之一

Copilot uses AI. Check for mistakes.
configureAuthenticators=Sukonfigūruotas autentifikatorius
mobile=Mobilus
totpStep1=Įdiekite <a href="https://freeotp.github.io/" target="_blank">FreeOTP</a> arba Google Authenticator savo įrenginyje. Programėlės prieinamos <a href="https://play.google.com">Google Play</a> ir Apple App Store.
totpStep1=Installa una delle seguenti applicazioni sul tuo cellulare:

Copilot AI Jan 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This translation appears to be in Italian ('Installa una delle seguenti applicazioni sul tuo cellulare') in a Lithuanian (lt) properties file. The translation should be in Lithuanian to match the file's locale.

Suggested change
totpStep1=Installa una delle seguenti applicazioni sul tuo cellulare:
totpStep1=Įdiekite vieną iš šių programėlių į savo telefoną:

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants