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

134
Visualizações
How to avoid hackers from writing in firebase database too much data?

I am building a firebase app that uses the realtime database. Using developer tools users can read that when they press a button their input is written in the "post" child of the database:

document.getElementById("sub").addEventListener("click", function() {
    var postText = document.getElementById("postbox").value;
    var firebaseRef = firebase.database().ref();
    firebaseRef.child("post").set(postText);
});

Suppose the user modifies the javascript file with a loop and writes authomatically lots of time whatever they want once they press the submit button:

document.getElementById("sub").addEventListener("click", function() {
     for (let i = 0; i < 100000000000000000000000; i++) {
     var firebaseRef = firebase.database().ref();
     firebaseRef.child("post").set("I have hacked u");
     }
});

If this happens I wuold end up with a huge bill if I am not careful + other issues with the website not properly working.
How do I prevent symilar uncontrolable writing events from occouring? Also authenticated users can do this trick if they know some coding...are cloud functions the only option to secure my database?

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