Firebase database,firestore and firebase storage are all integrated with security rules. This security rules let you control who can write and read your data. It also validate your data structure by rejecting write if such write doesn't meet your standards (e.g if the write isn't a number, if the write isn't a string, if the write doesn't contain, starts with or ends with a particular string, if the write isn't a current server timestamp, prevention of delete or creation of new data e.t.c). Security rules can also validate data with regex expressions.
With all this functionality offered via security rules, your data in firebase is secured.
As for cloud functions, you can bypass this security rules by using the admin api. Cloud functions doesn't requires security rules causes your code can't be seen, edited, created, deleted.