[Vuejs]-When can I trust my translated content in Vue?

0👍

You are asking several questions

As long as content from #2 is audited for nefarious content, is it safe to use as raw html?

Yes and no. In theory, if you check every single message, and know the context of every single message, and never have time constraints so people check every single message before each release, you are fine. In practice, people cut corners, or do not know that a particular message will be inserted as html, or do not understand how some string might be malformed html, but get converted by the browser to valid html that is actually nefarious. Someone might get access to your CMS and change a translation string that you didn’t expect to be changed. Someone might forge a form submission in your cms if it is not configured right by tricking an employee to visit an url.

Or is the mere fact that html could be in a translation file open us up to some sort of exploit?

v-html is just that. It places html unfiltered in your document.

What is that possibility, how does it work?

v-html with translated strings creates unnecessary risks and extra overhead by requiring a copywriter with extensive technical knowledge to check every single translation message, where instead you could have a copywriter without any technical knowledge do that. The only thing you need to do is use the pattern as outlined in the documentation, which allows anyone to change the translatable bits (which will be escaped), while keeping the html in your source control.

Leave a comment