Skip to content
This repository was archived by the owner on Dec 31, 2024. It is now read-only.
This repository was archived by the owner on Dec 31, 2024. It is now read-only.

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

Description

@darkylmnx

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions