Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

243
Visualizações
It is possible to parse text from html editor not using v-html in VueJS?

My project has admin panel and main page. On admin panel I can create posts using HTML editor (VueEditor in this example) post that in data base looks like this:

<p>Here is some test text from VueEditor</p>

Then, I want to parse it one the main page, but, of course, without <p> tag, so I use this:

<p v-html='item.plot'></p>

And here is a problem, IDE tells:

ESLint: 'v-html' directive can lead to XSS attack.(vue/no-v-html)

Is this really that dangerous? Should I parse it some other way?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Yes it is really that dangerous.

Consider what happens when I create the post.

Hi I'm Dave this is my <script>alert('pwned,' + document.cookie)</script> post!

I can now run arbitrary JS code on your website and steal login info for every user you serve this code too.

I'm not super familiar with vue in particular but most frameworks have an easy way to output sanitized html. I think this is {{ itme.plot }} in vue. This will not render an actual (or any other tag) but an escaped version &lt;script&gt; which the browser will not interpret as actual code.

There are a million other way to do XSS if you let me inject my own HTML in your website.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda