I want to implement a callable Firebase cloud function to modify an existing document on Firestore. When I search online, I found that I need to add admin privileges to my server then call it like:
const admin = require('firebase-admin');
admin.initializeApp();
const db = admin.firestore();
But in documentation(https://firebase.google.com/docs/admin/setup) it says admin SDK gives privileges to manipulate basically everything in Firebase platform. I do not want to give all privileges to a function call, or to a server. If I call a function related to User collection, I want that function to be able to manipulate User collection only.
My questions are: Is it safe to give all privileges to a function? Can reverse engineering be dangerous? If so, how do I block non-legit function calls? Is it possible to restrict access of a firebase function?