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

221
Visualizações
Mysql INSERT INTO SET ? syntax
await query(`INSERT INTO feedback.app_v2 SET ?`, feedback)

I wrote this line to code into my JS project to insert data in the concerning table.

I want to ask if this MySql syntax is safe from Sql Injection? Here feedback is an object whose keys matches the app_v2 table columns.

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

0

That's not valid MySQL syntax.

This is valid MySQL syntax:

INSERT INTO feedback.app_v2 SET mycolumn = ?

Yes, it is safe from SQL injection, because the dynamic value is restricted to a query parameter. This is not combined with the query until after the query has been parsed, so there is no way the parameter can introduce unintended syntax.


If the NPM package can do string substitution to put the key = 'value' syntax into the query string, that's not a true query parameter. The assignment must be part of the query before it is parsed, but proper query parameters are not combined with the query until after it is parsed.

So you're depending on the code in the NPM package to do the string substitution without any bugs that result in SQL injection vulnerability.

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