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

155
Visualizações
XSS prevention on an HTML textbox the returns javascript/ajax results

There is an HTML input textbox that has id paramater of exampleId. When something is submitted in this textbox and then submitted a javascript/ajax call is made and the correct results are returned. Cross-site scripting is needed on this textbox so I added into the javascript:

testVal=htmlEncode($('#exampleId').val());
$('#exampleId').val(testVal);

That works. Its prevents any cross-site scripting attacked. But the problem I am now having is if someone enters the following example: hello? It updates the value in the textbox to hello&#63 which I do not want.

Is there a better way to prevent cross-site scripting or is there a way I can also decode the value in the textbox so it would still display hello? while still keeping the above xss prevention?

about 4 years ago · Juan Pablo Isaza
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