Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!