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

179
Visualizações
Is NodeJS POST data (req.body) can be attacked/change/inject by hacker?

first of all, sorry for my bad English :)

Let say I have a model and controller for my REST API,

PostModel.js:

const postSchema = new mongoose.Schema({
    author: {
        type: mongoose.Types.ObjectId, 
        required: true
    },
    title: String,
    content: String
})

postController.js:

const createPost = async (req, res, next) => {
   const newPost = await Post.create(req.body);

   res.status(200).json bla bla bla
}

is data from req.body can be (edit / attack / inject) by the client?

I imagine like this:

  1. from frontend, form only have title and description fields
  2. user fill the title and description
  3. and user force attack/injects the author id to another user id

Thanks <3

over 4 years ago · Santiago Trujillo
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