Escape interpolated i18n params on innerHTML sinks#104
Open
boinger wants to merge 1 commit into
Open
Conversation
t() interpolates {placeholder}s unescaped and four call sites assign the
result to innerHTML. All current params are toFixed() numbers, so this is
hardening, not a live vuln. tHtml() escapes params only (templates keep
their markup); t() unchanged so alert/textContent keep raw err.message.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hardening, not a live vuln:
t()does raw{placeholder}interpolation and four call sites assign the result toinnerHTML(diag.recommendFix×2,ui.smartResInfo, and thedata-i18n-htmlbranch ofapplyTranslations). All current params on those paths aretoFixed()numbers, so nothing is exploitable today — but the first filename- or error-shaped param there becomes markup injection, and project files are shared between users.tHtml()escapes param values only; templates stay raw sincedata-i18n-htmltemplates legitimately contain markup.t()is untouched, so text sinks (alert,textContent) keep displaying raw error messages. Convention going forward: innerHTML sinks usetHtml.