How to secure firebase

I had searched before creating this topic. but i couldnt find any perfect solution.
How to make firebase secure

In what sense secure?
One simple way is to let only authorized users access data.

Another way, you can write detailed rules; which tag can be accessed and which can’t.