Don't like this style? Click here to change it! blue.css

LOGIN:
Welcome .... Click here to logout

Security Rules in Firebase (and RBAC in general)

Take home HW goal:

Role-Based Access Control (RBAC)

TLDR: a ROLE grants the right to VERB this NOUN, and a USER has many ROLES

You can find whole books written about RBAC and set theoretical implementations of it.

I've given that kind of lecture in the past... but I suspect it's like describing the thermodynamics of wind before you go fly a kite.

More Formal RBAC Notes

A classical RBAC system ends up with functions roughly named like this:

Firebase .read .write rules

Basics

Specifics

So a natural question is can you restrict the access of a user to REVOKE the right to:

Here is a firebase "CREATE" but not update:

$data_id : {".write": "!data.exists() || !newData.exists()"}

Interesting enough, but we need to play with it.

Make a firebase project and make a key "testing": {"stuff": "here"}. Now click rules, and put in the rules found in the following gist (the C but not U rule). Now use the simulator to test writing to /testing/stuff then writing to /testing/stuff2 and observe the difference.

Lovely Flag

Two rights make a wrong

See the Pen Flag Auth by Andy Novocin (@AndyNovo) on CodePen.