Securing your data structure with Security Rules - The Firebase Database For SQL Developers #8

Firebase · 77K views · 2017 · 12:09

Open on YouTube

Databases & storageWeb developmenttutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when working out how to write Firebase Security Rules that validate data and check references across paths, such as emulating foreign keys.

Recommended by 0 people across 0 different months, 2017 to 2019.

What it is

Eighth episode of the official Firebase 'Firebase Database for SQL Developers' series. It explains how Security Rules, a declarative server-side rules language, can validate and protect data structure in a schemaless database, including foreign-key-like constructs.

What people said

Cites Harish Kamboj · 2017-01 · Stack Overflow · on “Firebase permission for writing data in second table befor checking data in first table”

I am new to Firebase. I am following this Tutorial [this video] and trying to validate data, but didn't know why my data is not validating. I want to check first Authors table that user exists or not if exists then he can able to write. Simulation results Type write Location /posts/1/1 Data { "Authors": { "1": true } } Auth { "provider": "google", "uid": "1" } Admin false Write denied Line 69 (/posts/1/1) validate: "root.child('Authors').child(newData.child('Authors').val()).exists()" My security rules are: "users": { "$UID": { ".read": "auth.uid == $UID", ".write": "auth.uid == $UID" } }, "Authors": { ".read": true, ".write": false }, "posts": { ".read": true, "$POSTID": { ".write": "auth.uid !=

Cites johndpope · 2017-03 · Stack Overflow · on “Firebase Database in SQL”

to quote from video - "you can create foreign key like constructs" [this video] - I'm going to steer away from firebase and roll a sqlite db / just have the head of keeping it in sync.

Cites Learn2Code · 2017-05 · Stack Overflow · on “Firebase security rules newData.val() compared to data.val()”

[this video] this shows that it should be able to pull the value from the 'users' - 'token' as in the video it know that LA was not a value that existed but SF was!?

Cites JeremyW · 2019-01 · Stack Overflow · on “Embedding a Firebase Storage Video to Wordpress but Hiding the URL”

As Doug said in his comment, it is impossible to completely hide a download URL. There are complicated ways to obscure it, but I would recommend you avoid going down that rabbit hole - none are foolproof. Instead, you should implement your security using Firebase Storage's built-in security rules [LINK] - the situation you are describing is EXACTLY what this feature is designed to accomplish. You can put a rule in place that only users who have purchased the course ( meaning, they have that video's identifier under their account in the database ) are granted access... and you can even limit access to your project [LINK] ( see steps in answer #1 ) to specific domains. There are a ton of great