Answer the question
In order to leave comments, you need to log in
Is it safe to work with Firebase on the frontend?
There is a Firebase service that provides access to working with the database directly from the frontend (javascript). But how safe is it? Let's say a simple todo-list and the user has some tasks in it. Since the request to the database is sent directly from the client, the user can easily change the request condition and look not at his own, but at other people's tasks? As I understand it, this system turns out to be meaningless and a backend is clearly needed here?
Answer the question
In order to leave comments, you need to log in
Firebase has functionality for authentication and rights differentiation. If everything is done correctly, then the user will never receive other people's data. Everything is written in the docs.
Since the request to the database is sent directly from the client, the user can easily change the request condition and look not at his own, but at other people's tasks? As I understand it, this system turns out to be meaningless and a backend is clearly needed here?
{
"rules": {
"tasks": {
"$user_id": {
// читать может только сам пользователь
".read": "$user_id === auth.uid",
// писать могут все аутентифицированные и только создавать новые
".write": "auth !== null && !data.exists()"
}
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question