Recall & Review
beginner
What are Firebase Storage security rules?
Firebase Storage security rules control who can read or write files in your storage. They protect your files from unauthorized access.
Click to reveal answer
beginner
How do you allow only authenticated users to upload files in Firebase Storage?
Use the rule: <br>
allow write: if request.auth != null;<br>This means only users signed in can upload files.Click to reveal answer
intermediate
What does
request.resource.size check in Firebase Storage rules?It checks the size of the file being uploaded. You can limit file size to prevent very large uploads.
Click to reveal answer
intermediate
Why use
resource.metadata in Firebase Storage rules?It lets you check metadata of existing files, like content type or custom tags, to control access or updates.
Click to reveal answer
advanced
What is a best practice for Firebase Storage security rules?
Start with strict rules denying all access, then allow only what is needed. Always test rules to avoid accidental exposure.
Click to reveal answer
Which Firebase Storage rule allows only signed-in users to read files?
✗ Incorrect
Only
request.auth != null checks if the user is signed in.How can you limit file uploads to 5 MB in Firebase Storage rules?
✗ Incorrect
Use
request.resource.size to check the size of the new file being uploaded.What does
resource represent in Firebase Storage rules?✗ Incorrect
resource refers to the current file already stored.Which is a safe default rule for Firebase Storage?
✗ Incorrect
Denying all access by default is safest to prevent accidental exposure.
How can you check if a user owns a file in Firebase Storage rules?
✗ Incorrect
You compare the user's ID with the file's owner metadata to allow access only to owners.
Explain how Firebase Storage security rules control access to files.
Think about who can do what with files and how rules check that.
You got /4 concepts.
Describe a simple rule to allow only authenticated users to upload files smaller than 2 MB.
Combine user check and file size limit in one rule.
You got /3 concepts.