Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQUEST] escape parameters when using v-html #144

Closed
darkylmnx opened this issue Apr 17, 2017 · 1 comment
Closed

[FEATURE REQUEST] escape parameters when using v-html #144

darkylmnx opened this issue Apr 17, 2017 · 1 comment

Comments

@darkylmnx
Copy link

I would like you to consider escaping parameters passed to the $t method.

Why ?

When, we want to use html in translations, we have to use v-html right ? But what if we pass a parameter which comes from the user ? Then that's the opened door to XSS

Example :

// my translations would contain something like
var fr = {
 "hello": "Hello <strong>{name}</strong>, how are you today ?"
}

// lets assume here that "username" contains "thomas petrov"
<div v-html="$t('hello', {name: username})"></div>
// here, no problem

// lets assume here that "username" contains "thomas <br> petrov"
<div v-html="$t('hello', {name: username})"></div>
// now we have a problem

I think all parameters must be filtered against XSS, or at least give an option to set global escape on parameters and locally escape them when needed too.

something like this : https://angular-translate.github.io/docs/#/guide/19_security

@kazupon
Copy link
Owner

kazupon commented May 11, 2017

v7.0.0-beta.1 release out!
please check it! :)
https://github.com/kazupon/vue-i18n/releases/tag/v7.0.0-beta.1

@kazupon kazupon closed this as completed May 11, 2017
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

No branches or pull requests

2 participants