Firestore Security Rules - How to Hack a Firebase App

  Рет қаралды 128,262

Fireship

Fireship

Күн бұрын

Learn how to hack a Firebase app, then configure solid Firestore Database security rules to ensure data integrity. angularfirebase.com/lessons/f...
- Rules Reference: firebase.google.com/docs/fire...

Пікірлер: 144
@Fireship
@Fireship 6 жыл бұрын
Hey everybody. Just in case you missed to the point... NEVER ship a Firebase app without solid rules in place first!
@patrickmullot73
@patrickmullot73 6 жыл бұрын
Same goes with stackblitz. It's a wonderfull tool, but DO NOT share production API key there.
@Fireship
@Fireship 6 жыл бұрын
I'm sure you could scape a bunch of secret keys there
6 жыл бұрын
Very usefull Jeff, Thanks for your awesome videos
@moradabdelgaber5958
@moradabdelgaber5958 6 жыл бұрын
I'm using Role ( allow read ,write : if request.auth.uid != null ) when I logged in I get data it's ok , but when I log out the user I get the error : Missing or insufficient permissions. first I thought it was because of I didn't unsubscribe the Observable I tried (rxjs/operator/takeWhile) even I used async pipe . I got the same error please help !!!
@janoschii
@janoschii 6 жыл бұрын
You are allowing read and write ONLY if the request.auth.uid is not null. So!
@justserv
@justserv 6 жыл бұрын
Very important video! I've been waiting for someone to create a decent intro to Firestore rules like this, and I'm glad you showed us exactly how easy it can be to do something malicious to an unsecured database. Honestly I was asking myself for months how someone might go about erasing my database, and that was an eye-opener! I love how your tutorials are straight-to-the-point; every second always has something useful in it! Keep up the awesome work!! :)
@MatuellaSlipknot
@MatuellaSlipknot 6 жыл бұрын
Your speech is really on point and the video is so well edited (a minimalist edition like you did is awesome btw). Kudos for all the clean and straightforward explanations, 10/10.
@dalemoncayo
@dalemoncayo 6 жыл бұрын
This is the best firebase tutorial ever. Youre amazing man!
@patrickmullot73
@patrickmullot73 6 жыл бұрын
AWESOME!!! That's pure added value Jeff!
@Fireship
@Fireship 6 жыл бұрын
Thank you! This is a very important area that seems to get overlooked way too often.
@Hardikkmadaan1702
@Hardikkmadaan1702 4 жыл бұрын
The best and the only video you know to protect your data on Cloud Firestore. Thanks a lot buddy!
@goku21youtub
@goku21youtub 3 жыл бұрын
even though the title says something different , this is the most relatable firestore security rules video ive seen till now . im a noob and trying to learn the firestore system right now and this video was extrmely helpfull , well explained , not too long and not too short . Thanx alot !
@imacuser101
@imacuser101 6 жыл бұрын
Keep up the good work! Your videos are always the best and to the point
@bensonmwaura9494
@bensonmwaura9494 6 жыл бұрын
DevOps take note! Always something productive to look forward to, great content.
@zoidbergZA
@zoidbergZA 6 жыл бұрын
10/10 as always with this man... liked, subbed, notified
@Fireship
@Fireship 6 жыл бұрын
Thank you, much appreciated!
@chordfunc3072
@chordfunc3072 5 жыл бұрын
Thanks for putting so much time into making this... Always great videos and always stunning graphics, and crisp audio :D Always find my way back to your channel :)
@zeroblackstar
@zeroblackstar 6 жыл бұрын
Great videos man, I've been looking for something in depth for a while. Will be getting myself your course/Book for sure.
@holylambo
@holylambo 10 ай бұрын
amazing video, i have a lot of trouble concentrating on reading the docs so this was incredibly helpful!
@MatthijsvanHest
@MatthijsvanHest 5 жыл бұрын
Very clean video, totally explaining exactly what I needed from firebase to safely start developping. Firebase is new to me, I was concerned I can't do a lot of things I need to do and know how to do otherwise.. But your videos show otherwise, Firebase is just different, but it's all there!
@samadritsarkar2
@samadritsarkar2 2 жыл бұрын
Learnt a lot from this 3 years old vid! Thanks mate
@kamalkamals
@kamalkamals 6 жыл бұрын
This is the best video explain firebase operations roles, we wait to add more, thnx Jeff
@FidelGuajardo
@FidelGuajardo 4 жыл бұрын
This video content is super important and useful to me. Thank you!
@moibe182
@moibe182 7 ай бұрын
Thanks Fireship! You keep me improving at my job thanks ❤
@prabhursec9627
@prabhursec9627 3 жыл бұрын
I was confused about this thing before watching this. But ,now everything becomes clear. Nice explanation☺️. Thank you🙂
@Rouwen87
@Rouwen87 2 жыл бұрын
This is an amazing video, answered all of my questions for my server less app I was going to make. Thank you!
@thijsoudeavenhuis1015
@thijsoudeavenhuis1015 6 жыл бұрын
Hey guys, this is really good stuff. The docs on firestore are great but only cover the basis. these videos show some really clever tricks to writing more secure firebase apps.
@sellyshootsandscores9300
@sellyshootsandscores9300 11 ай бұрын
I loved the emphasis on “And it’s really important that you don’t mess up your back-end rules”
@thitemple
@thitemple 5 жыл бұрын
Great content on this video and the channel overall. Thanks, I like how on point your examples are and I can't really understand how anyone would downvote a video like this...
@chngo7180
@chngo7180 4 жыл бұрын
The upvote is you who got scared by the title for the kind of hack that might befall your database and quickly clicked on the link. The downvote is the evil doer who expected to learn how to hack in your database but won't be able to do so anymore. @Fireship Thanks for the great content!!
@adriantabay97
@adriantabay97 6 жыл бұрын
Thank u! Ive learned a lot. It just so perfect because I am writing security rules on my app's firestore
@FidelGuajardo
@FidelGuajardo 4 жыл бұрын
Very useful content about using functions to build authentication rules. I had never seen this before.
@iMed-Med
@iMed-Med 3 жыл бұрын
Am I the only one that watched all his videos till a point where I listen to it as a podcast? Great content
@dustinpatterson3534
@dustinpatterson3534 3 жыл бұрын
Thanks so much for this video! It was a huge help!
@user-zg1fg7vx8u
@user-zg1fg7vx8u 2 ай бұрын
OMG this video help me so much!!!!! Hope you can do more videos like this!! Keep moving on👍👍
@MrLuc420
@MrLuc420 6 жыл бұрын
sweet! Exactly what I was looking for!
@RafaelSantos-pq4od
@RafaelSantos-pq4od 6 жыл бұрын
Very good, keep making videos about Security rules in firestorm, there is very little material on the web ... - from Brazil
@Fireship
@Fireship 6 жыл бұрын
Will do, I often incorporate them into my advanced lessons. Also, I think the official Firebase team has some rules content around the corner.
@ngotechy
@ngotechy Жыл бұрын
Your video was extremely clear and informative. I just wanted to mention that I didn't quite understand the reference to episode 75 regarding user-based rules. Can you please clarify that for me?
@tntg5
@tntg5 2 жыл бұрын
Hi Jeff! Thanks for this one! Do you know if there is a way to integrate AppCheck into an ionic capacitor app?
@postfixnotation9829
@postfixnotation9829 4 жыл бұрын
Extremely helpful and easy to understand! I have a question though which is not related to the content of this video, but let's say you wanted to ship an app to the chinese market, I assume Firebase doesn't work there, right? Is AWS Amplify or another product an appropriate alternative for this kind of issue? Thx, have a great day!
@georgedicu6001
@georgedicu6001 Жыл бұрын
for the roles, I would suggest using customClaims on JWT supported by firebase auth, and its server-side.
@abdulalimrajoub6063
@abdulalimrajoub6063 6 жыл бұрын
Thanks man , it's awesome
@GalTadmor
@GalTadmor 6 жыл бұрын
Your timing couldn't be better. I needed something exactly like that a few hours ago. Perfect as always, thanks a bunch! Quick question: what about the database.rules.json file? Should I match it to the backend rules? If so, what's the "translation" of it to a JSON file?
@Fireship
@Fireship 6 жыл бұрын
Those rules apply to Realtime DB, but this video is specific to Firestore. If you run `firebase init firestore` it will generate another file to define your rules in the IDE.
@GalTadmor
@GalTadmor 6 жыл бұрын
Angular Firebase Awesome. Thank you!
@CardinalHijack
@CardinalHijack 5 жыл бұрын
If you have your entire app hosted on one firebase project, IE hosting, firestore, cloud functions etc, is it possible to only allow requests from things on this project? So for example only allow database connections from the site hosted on your project, or only allow the database to be accessed by cloud functions on your project. In effect, just stoping random IPs from connecting to your databse or firing your functions?
@gurucode.studio
@gurucode.studio 3 жыл бұрын
Does that works for protecting videos from being watched or downloaded if the user is not subscribed or has bought the video course for example?
@razakadam74
@razakadam74 6 жыл бұрын
the title scared me at first but I really enjoyed it. I am always ready to take things to the next level... :)
@Fireship
@Fireship 6 жыл бұрын
Haha, that was my goal :)
@konfinoyair
@konfinoyair 5 жыл бұрын
you helped me so much. thanks
@agung_laksana
@agung_laksana 4 жыл бұрын
Really Glad to find your channel since I want learn about serverless using firestore and google cloud functions One topic that I am not really confident yet is about security rules. Do you have a course about security rules ? I just only find web page about firestore security rules cookbook in your website, I mean the video version about this. Do you have one ? A pro version in your website is also ok Because it is about security, so it will be great if I can learn deeply through the video from beginner level to advanced Thank you very much for all your contents, hope you make it because I can't find a good one on the internet 😀
@konfinoyair
@konfinoyair 5 жыл бұрын
This is not the original post, but a second revision. Anyway thank you.
@contactmsr
@contactmsr 4 жыл бұрын
this is super important tips, i think google firebase team must have these kinds of check list in place
@mateja176
@mateja176 6 жыл бұрын
Jeff is a legend
2 жыл бұрын
Awesome, thanks!
@georgedicu6001
@georgedicu6001 Жыл бұрын
isn't the request.time supposed to be gather than resource.data.createAt (this files is the one already existing, so it will be an update operation)? the way you've written it, means the request has to always be in the past . in this case you allow update on {productId} for the 1st 60 secs, then you always deny?
@Rafael-hk9pg
@Rafael-hk9pg 2 жыл бұрын
How can you apply what is told at 9:23 for reading data? Thanks a lot!
@remoreacts91
@remoreacts91 5 жыл бұрын
So if I did my rules right, the curl -x command should not work right? I pressed enter and nothing happened..so I am guessing atleast that collection I tested is safe.
@haidarrmehsen
@haidarrmehsen 4 жыл бұрын
What if I need to put some validation on the data in the incoming request but the validation code needs me to define some variables and is not small code it is complex, what should I do in this case???
@bono95zg
@bono95zg 6 жыл бұрын
is it posible to only allow read if on your hosted domain?
@Laithabujbara
@Laithabujbara 2 жыл бұрын
Best explanation ever 👌 👏
@AmitK
@AmitK 6 жыл бұрын
is this possible to expose credentials while using firebase with react native mobile app ?
@timsecond
@timsecond 3 жыл бұрын
8:22 Can I use the similar method to get data stored in Firebase Realtime Database?
@AnumQudsiaAnumIO
@AnumQudsiaAnumIO 5 жыл бұрын
Can you limit write access if you are not using Firebase Auth?
@saranshagarwal2500
@saranshagarwal2500 5 жыл бұрын
How to change rule for a particular collection. Like i have a collection by the name Test and in the collection there are documents. all documents have same fields. i want every document field must have different data.
@sexyeur
@sexyeur 4 жыл бұрын
Jeff's awesome! 👍
@OfferoC
@OfferoC 6 жыл бұрын
How do you test and deploy these rules?
@maheshjamdade1
@maheshjamdade1 3 жыл бұрын
hey, thanks for this great video I wanted to know how can we have rules in a chat app where I have two types of roles seller and buyer and I want to prevent sellerseller or buyerbuyer communication basically I want that only sellerbuyer can communicate. Some Insights on this would be really helpful.
@robbertstapel788
@robbertstapel788 2 жыл бұрын
Maybe a stupid question... but what if i am somehow able to set the uid to 1, true, or any other value as long as it's not null?
@albertrenshaw4252
@albertrenshaw4252 5 жыл бұрын
At 5:53 you say or-statements only check "if one of the conditions is true"; did you mean to say "if one or both of the conditions are true", or is `or` treated as XOR by firebase?
@TimeoutMegagameplays
@TimeoutMegagameplays 5 жыл бұрын
Probably he meant to say if one or both of the conditions are true. You can very easily test it in the simulator if that makes any difference, you could test: allow read: if true || true;
@HungTinTrinh
@HungTinTrinh 3 жыл бұрын
Amazing good job!
@jorgeriveramx
@jorgeriveramx 3 жыл бұрын
awesome as allways
@tfktoufik9724
@tfktoufik9724 Жыл бұрын
thanks bro you help me
@drmucahiderdogan
@drmucahiderdogan 3 жыл бұрын
Great tutorial.
@adminmail6006
@adminmail6006 6 жыл бұрын
need what background music is running ... can anyone??
@godmen11
@godmen11 5 жыл бұрын
In the case when we want to restrict access to data that user owns: what if the userId is stolen? (request.auth.uid) Is there anything that verifies that?
@robrabbit8288
@robrabbit8288 4 жыл бұрын
I guess, he needs to steal the password aswell, since u can check if the user is authenticated.
@akashtakawale9074
@akashtakawale9074 3 жыл бұрын
This is so cool !!
@joshbedo8291
@joshbedo8291 4 жыл бұрын
Awesome thanks!
@cigrastudio_dev
@cigrastudio_dev 2 жыл бұрын
I want a user to only edit the data of other users if he/she clicks on their profile. How to write rules for the scenario?
@TimeoutMegagameplays
@TimeoutMegagameplays 5 жыл бұрын
About the timeouts, you show us how to prevent users from modifying a document, but how would I prevent someone to spam create documents? For instance, I want to limit to 10 documents a minute to be created in /users/{userId}/files/, is that possible?
@ahsath
@ahsath 4 жыл бұрын
you can with query.limit < 10
@KarlSchmaltz
@KarlSchmaltz 4 жыл бұрын
Wouldn't having the roles in the user's document be unsafe because that user can edit that document and potentially promote their role? I guess you could always check the incoming data for modifications to the roles portion of the object. Would it be better to have a separate collection that contains all of the user roles that they can't access?
@David-dw8wy
@David-dw8wy Жыл бұрын
Or how about using custom claims on their auth object
@rudrasarkar1852
@rudrasarkar1852 4 жыл бұрын
My question is : How can I find that products id, I guess firebase front end don’t show id of the product id to client side.
@shivam-dua
@shivam-dua 4 жыл бұрын
Thank you!
@williamxsp
@williamxsp 5 жыл бұрын
What if I have a query like this.db.collection(`users`, ref => ref.where("someProperty", "==", someValue) );?
@aankushchauhan
@aankushchauhan 2 жыл бұрын
really helpful
@beneditomauroo
@beneditomauroo 4 жыл бұрын
Firebase sugests using custom claims for role auth
@kirill4531
@kirill4531 4 жыл бұрын
Is there any way I can limit the number of docs user can create? I have a field "owner" = "user@email.com" in a doc, and I don't want a new record if there are already 100 records with this owner.
@egamingizback444
@egamingizback444 2 жыл бұрын
How i can give to an specific user the verified badge to my app?
@MuhammadbinYusrat
@MuhammadbinYusrat 3 жыл бұрын
I am thinking if I am offering a service which is open for public (like a survey or something) my only option would be (as far as I understand) is to allow read write for everyone (may be restricting it to a specific collection?) but still it would be public write access... What can be done about this scenario? Because even if we add anonymous authentication, the curl request that you talked about in the beginning of your video will still contain all the data required to run it.. and can be pasted in terminal and then we're done again.. I cannot find anything on this on Google too.. may be I am missing something very obvious here.
@spl45hz
@spl45hz 3 жыл бұрын
You could allow create and read, but no write or delete. However the biggest problem is that anybody can request as many reads and creates as he wants, which might leave you with a huge firestore bill. As long as we cant limit this behavior I suggest staying away from firestore
@spl45hz
@spl45hz 3 жыл бұрын
Actually I ran some tests, while spamming is still possible, when an attacker spams your writes with one account as much as possible (in my test I achieved 15 writes per second with one mobile device, but without multithreading), it would cost you around 15*60*60*25/100.000 *0,18=2,33$ per day. However if an attacker could manage to attack you with 10 threads simultaneously, he can achieve a damage of around 23$ per day. Or with an small botnet which might cost around 2000$ a month or 70$ a day according to kaspersky (with around 100 active bots and assuming 10 writes per bot=1000 writes per second) would cost you around 150$ a day in damages. An attacker therefore might collect ransom from you, this happend a lot with ddos in the past and might become a problem if the app/service grows larger. One last thing I wrote 10.000 documents from the same user in a short period of time without throttling, so firestore does not automatically limit requests.
@MuhammadbinYusrat
@MuhammadbinYusrat 3 жыл бұрын
@@spl45hz There has to be a workaround for this. Why isn't this happening with more people?
@deepikamadaan95
@deepikamadaan95 3 жыл бұрын
Hi, Kindly reply, its so urgent. I have 2 apps, 1 is for company and another one is for clients. And in both the apps, registered users are modifying data in the same collection documents. No one is the owner of any document. In that case how can I make sure that my firebase data is safe for that collection. I am just checking user is authenticated user in the rules. Please Please reply, I am very scared before publishing my apps.
@MrMaxBushido
@MrMaxBushido 5 жыл бұрын
This sounds too complicate for me, where should i go to understand how to secure my saved data?
@SouhailELAmrani
@SouhailELAmrani 4 жыл бұрын
this rules doesn't exist in realtime database firebase ? how can i protect my Realtime data ??
@moradabdelgaber5958
@moradabdelgaber5958 6 жыл бұрын
I'm using Role ( allow read ,write : if request.auth.uid != null ) when I logged in I get data it's ok , but when I log out the user I get the error : Missing or insufficient permissions. first I thought it was because of I didn't unsubscribe the Observable I tried (rxjs/operator/takeWhile) even if I used async pipe , I got the same error . please help !!!
@ThatsEli
@ThatsEli 5 жыл бұрын
You only allowed to read and write with the condition request.auth.uid != null.(Only allow when logged in)
@solomonaryeetey7370
@solomonaryeetey7370 5 жыл бұрын
Just subscribed
@yeilmusic
@yeilmusic 4 жыл бұрын
MUCH LOVE
@boysattitude3283
@boysattitude3283 Жыл бұрын
Agar firebase ki OTP share kar di to kya kare
@PACKERSFANSheshank
@PACKERSFANSheshank 4 жыл бұрын
what would happen if someone spammed my db with requests increasing my firebase bill
@nfaical3
@nfaical3 3 жыл бұрын
I guess that what google want. Its very easy to loop with a read request.
@PACKERSFANSheshank
@PACKERSFANSheshank 3 жыл бұрын
@@nfaical3 fair enough...
@TheJorge421
@TheJorge421 3 жыл бұрын
It's funny that fireship made a KZbin post( don't know how to call them) where it says they were "attacked" just like you say
@Fatfit2
@Fatfit2 4 жыл бұрын
0:24 Savage
@budhanshukajla3793
@budhanshukajla3793 3 жыл бұрын
How to get my firebase based android app's IP address?
@ameerattaa2250
@ameerattaa2250 6 жыл бұрын
hi my friend how can moniter my firestore database so that whenever a new data added by a user the admin get notification on his app
@Fireship
@Fireship 6 жыл бұрын
That's a good use case for a cloud function. Check out some of these lessons for ideas angularfirebase.com/tag/functions/
@ameerattaa2250
@ameerattaa2250 6 жыл бұрын
Angular Firebase i will thank you very much
@hojdog
@hojdog 5 жыл бұрын
Everybody, use *Custom Claims* for role based access, not this way.
@Cnuggets
@Cnuggets 4 жыл бұрын
How do i navigate to two worded collections like ‘user record’ ex: match/ user record/{urId}
@Cnuggets
@Cnuggets 4 жыл бұрын
please help! I’m stuck
@yocheeseify
@yocheeseify 4 жыл бұрын
Have you figured this out?
@Cnuggets
@Cnuggets 4 жыл бұрын
@@yocheeseify you have to restructure your data, so far there is no solution for this. It's also good practice to using the naming conventions like in coding.
@yocheeseify
@yocheeseify 4 жыл бұрын
@@Cnuggets ah gotcha. Thanks for the assist!
@Cnuggets
@Cnuggets 4 жыл бұрын
The Apocalypse You are welcome. Happy Coding!
@wesleycampos6586
@wesleycampos6586 6 жыл бұрын
Queria saber falar inglês para não ter que ficar usando legendas kkkkk... mas parabéns pelo seu trabalho =]
@TimeoutMegagameplays
@TimeoutMegagameplays 5 жыл бұрын
kkkkk Um Brasileiro aqui
@tonyjaradev
@tonyjaradev 3 жыл бұрын
Lifesaver
@vid2ification
@vid2ification 3 жыл бұрын
Just need an alternative nd functional os for Moto Z⁴... Shilltube offers no examples, and google doesn't want to show those seach results.
@avilainkennefoue290
@avilainkennefoue290 3 жыл бұрын
The real title of this video is: how to prevent your Firestore from getting hacked !
@razakadam74
@razakadam74 6 жыл бұрын
Wish I could have 10 - 30 mins of slack time with you.
@user-on8cy4me5n
@user-on8cy4me5n 2 жыл бұрын
Please hack code password for firebase
@DjWizard1991
@DjWizard1991 4 жыл бұрын
12 Guys is the one who tried to hack into your apps
@dr_rick
@dr_rick 6 жыл бұрын
You're not teaching how to hack it, you're teaching how to secure it, everything you did to "hack" is by design. Great tutorial, I just suggest you fix the title and description of the video.
@Fireship
@Fireship 6 жыл бұрын
That's a fair point, but the title is tongue-in-cheek. My main goal is to emphasize that your Firebase data is vulnerable unless you secure it with rules.
@dr_rick
@dr_rick 6 жыл бұрын
Yes, I totally understand that, Jeff. I just mean that some people might expect to learn how to secure an actual hack. Kinda of a click bait if you know what I mean. But I also think it's good to bring attention to this aspect of firestore, since it's becoming famous and it's still something new. Thanks for the response and for the video!
Security Rules! 🔑 | Get to know Cloud Firestore #6
22:39
Firebase
Рет қаралды 265 М.
100 Firebase Tips, Tricks, and Screw-ups
24:31
Fireship
Рет қаралды 183 М.
I Built a Shelter House For myself and Сat🐱📦🏠
00:35
TooTool
Рет қаралды 24 МЛН
Каха инструкция по шашлыку
01:00
К-Media
Рет қаралды 4,2 МЛН
7 Cryptography Concepts EVERY Developer Should Know
11:55
Fireship
Рет қаралды 1,3 МЛН
10 regrets of experienced programmers
8:16
Fireship
Рет қаралды 1 МЛН
Unhinged ransomware attack targets hospitals
4:22
Fireship
Рет қаралды 363 М.
Understanding Firestore Security Rules with Examples
18:33
Joshua Morony
Рет қаралды 41 М.
Introduction to Firebase Security Rules - Firecasts
7:07
Firebase
Рет қаралды 59 М.
Google's secret algorithm exposed via leak to GitHub…
3:45
Fireship
Рет қаралды 1,1 МЛН
microsoft's new AI feature is an absolute dumpster fire
9:34
Low Level Learning
Рет қаралды 51 М.
7 Amazing Developer Tools that you're not using yet
6:27
Fireship
Рет қаралды 1,9 МЛН
Firebase - Back to the Basics
25:23
Fireship
Рет қаралды 579 М.
Apple watch hidden camera
0:34
_vector_
Рет қаралды 56 МЛН
ЭТОТ ЗАБЫТЫЙ ФЛАГМАН СИЛЬНО ПОДЕШЕВЕЛ! Стоит купить...
12:54
Thebox - о технике и гаджетах
Рет қаралды 151 М.
How To Unlock Your iphone With Your Voice
0:34
요루퐁 yorupong
Рет қаралды 19 МЛН
Дени против умной колонки😁
0:40
Deni & Mani
Рет қаралды 10 МЛН
С ноутбуком придется попрощаться
0:18
Up Your Brains
Рет қаралды 316 М.