Skip to content

Enable i18next interpolation escaping - #122

Open
js665999 wants to merge 1 commit into
v3.x/stagingfrom
v3.x/bugfix/i18nEscapeValue
Open

js665999 wants to merge 1 commit into
v3.x/stagingfrom
v3.x/bugfix/i18nEscapeValue

Conversation

@js665999

Copy link
Copy Markdown

Summary

  • Change interpolation.escapeValue from false to true in webClient/src/assets/i18n/i18n.js, so i18next HTML-escapes values substituted into translation templates.

Why

With escapeValue: false, interpolated values are emitted unescaped. Nothing is exploitable today: every translation is rendered through JSX text nodes, which escape output, and no dangerouslySetInnerHTML exists in webClient/src. The risk is latent. If a translation is later rendered through dangerouslySetInnerHTML or a direct DOM write, externally influenced values (for example status text received from other desktop plugins) would go out unescaped. This is a sample app that others copy, so the safer default is the better one.

escapeValue: false would leave interpolated values unescaped if a translation were ever rendered outside React's JSX escaping.
Signed-off-by: js665999 <js665999@broadcom.com>
@sonarqubecloud

Copy link
Copy Markdown

@1000TurquoisePogs

Copy link
Copy Markdown
Member

Do you have an example of a bad value and how this corrects it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Ready for Review

Development

Successfully merging this pull request may close these issues.

2 participants