On Firebase Realtime Database I have the default rules:
{
"rules": {
".read": false,
".write": false
}
}
Which should mean it denies all access, according to the docs. But then I tried this code sample for Firebase Functions. This one about writing to google sheets. At some points in the code, it writes my API Key to my Firebase Realtime Database.
await admin.database().ref(DB_TOKEN_PATH).set(tokens);
And at another point reads my API Key that it had recorded:
const snapshot = await admin.database().ref(DB_TOKEN_PATH).once('value');
And to my surprise: both are working fine despite the security rules. I can go to the Firebase Console and see the API Key recorded in the same Database that is supposed to be denying all access.
What exactly does this mean? Firebase Functions can ignore security rules? Or am I misunderstanding what the security rules mean and my database is actually vulnerable for anyone to read my API Keys?