Who can read and upload your Firebase Storage files?
How Firebase Storage rules decide who reads and uploads files, what open and signed-in-only rules allow, and how to check yours with and without code.
Cloud Storage for Firebase decides access with rules, not with your app code. The rule allow read, write: if true lets anyone read and upload. A rule that only checks signed-in lets any account touch every file. Look at each rule and ask who it lets in.
What are Firebase Storage security rules?
Every file request goes through a rules file. The rules use match and allow statements that set a condition for access at a path, as the Storage rules guide describes.
AI tools write this file for you, often to make an upload button work. The file is short, so one loose line can cover your whole bucket.
You can see yours in the Firebase console under Storage, then Rules. With the CLI, open the rules file named in your firebase.json, per the same Storage rules guide.
Why does "allow read, write: if true" matter?
That line turns every path it covers into a public folder. The Storage setup guide says public rules for development "does make Cloud Storage open to anyone." Anyone includes people who never installed your app.
The same guide says the default is the opposite: read and write access is restricted to signed-in users. Test mode and public rules are a choice someone made, often you or your AI tool, to get past a permission error.
I could not find an expiry date for Storage test mode in the pages I read. The rules basics page mentions picking Test mode but gives no Storage rules and no time limit. Do not count on a timer to close it. Read your rules file.
A second trap is a rule that only asks for a signed-in user: allow read, write: if request.auth != null. The basics page tells you not to leave data open to any signed-in user, even in development. If your app lets anyone sign up, that is nearly the same as public. Any account can read and overwrite any other user's files. The same mistake in Firestore is covered in Firebase rules that only check request.auth.
How do you check your Storage rules without code?
You do not need to write code to read this file. Try this:
- Open the Firebase console, go to Storage, then Rules.
- Search for
if true. Note which paths it sits under. - Search for
request.auth != null. Ask whether that line also names an owner. - Look for
match /{allPaths=**}or a match on your whole bucket. A loose rule there covers every file. - Open the Rules Playground and run a read as an unauthenticated user on a file path you know exists.
The Rules Playground page says you can simulate a request as an unauthenticated user, an authenticated anonymous user, or a specific user ID. After you click Run, it shows whether access was allowed or denied. For Storage, enter a path in the Location field. If the Playground allows a read with no sign-in, your files are public at that path.
Test a second case: sign in as one user and read a path under another user's ID. If that is allowed, the rule checks "signed in" and not "owner".
The Playground is for quick checks. The same page points to the emulator for full testing.
For developers: what do the fixed rules look like?
Put each user's files under a path that holds their ID, such as users/{userId}/avatar.png. Then compare the path to request.auth.uid. The rules conditions page shows this form: allow write: if request.auth.uid == userId.
The page also shows a size and type check on upload: files under 5 * 1024 * 1024 bytes (5 MB) whose content type matches image/.*. Here they are together for rules_version = '2':
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /users/{userId}/{allPaths=**} {
allow read: if request.auth != null
&& request.auth.uid == userId;
allow create, update: if request.auth != null
&& request.auth.uid == userId
&& request.resource.size < 5 * 1024 * 1024
&& request.resource.contentType.matches('image/.*');
allow delete: if request.auth != null
&& request.auth.uid == userId;
}
}
}What this allows: a signed-in user can read, replace and delete files under their own users/{their uid}/ folder. They can add or replace a file only if it is under 5 MB and its content type starts with image/. No other user matches an allow in this block.
Notes on the pieces, each from the core syntax page:
- Version 2 recursive wildcards match zero or more path items, so
{allPaths=**}covers files in subfolders. readsplits intogetandlist.writesplits intocreate,updateanddelete. That is why delete has its own line.- When several
allowstatements match one request, access is granted if any one is true. A leftoverif trueelsewhere in the file cancels your owner check. Search for it.
The content type in request.resource is metadata sent with the upload. The docs I read do not say it inspects the file bytes, so treat it as a filter on what the client declares, not proof of what the file is.
For a public profile picture, the conditions page shows allow read; with an owner-only write. That is fine when public is the goal. Say it on purpose.
How do you test the rules before you deploy?
Use the Emulator Suite. The emulator setup page gives this command for Storage: firebase emulators:start --only storage.
For automated tests, the unit testing page names the @firebase/rules-unit-testing module. It gives you authenticatedContext for a signed-in user and unauthenticatedContext for a client with no sign-in. Write one test that should succeed and several that should fail: no sign-in, wrong user, a file over the size cap, a non-image type.
If a test that should fail passes, the rule is too open.
If you want a second look at your project, ShipSafe can scan it: ship-safe.co/scan.
Sources
- Cloud Storage for Firebase Security Rules, https://firebase.google.com/docs/storage/security/start, read 2026-11-28
- Security Rules language and core syntax, https://firebase.google.com/docs/storage/security/core-syntax, read 2026-11-28
- Rules conditions for Cloud Storage, https://firebase.google.com/docs/storage/security/rules-conditions, read 2026-11-28
- Security Rules basics, https://firebase.google.com/docs/rules/basics, read 2026-11-28
- Get started with Cloud Storage on web, https://firebase.google.com/docs/storage/web/start, read 2026-11-28
- Rules Playground, https://firebase.google.com/docs/rules/simulator, read 2026-11-28
- Connect your app to the Emulator Suite (rules), https://firebase.google.com/docs/rules/emulator-setup, read 2026-11-28
- Build unit tests for Security Rules, https://firebase.google.com/docs/rules/unit-tests, read 2026-11-28
Questions and answers
- Is Firebase Storage public by default?
- The [web setup guide](https://firebase.google.com/docs/storage/web/start) says read and write access is restricted so only signed-in users can read or write. Files become public to anyone when someone writes a rule that allows it, such as `allow read: if true`, or picks a public setup during development. Open your rules file and read it. Do not assume the default is still in place.
- How long does Firebase Storage test mode last?
- The pages I read do not state an expiry for Storage test mode. The [rules basics page](https://firebase.google.com/docs/rules/basics) mentions Test mode at bucket creation but gives no Storage rules and no time limit. Check the rules file in the console instead of relying on a date. If it contains `if true`, it is open now, whatever happens later.
- Is "request.auth != null" enough for user files?
- It only asks whether someone is signed in. Any account passes, so one user can read or overwrite another user's files unless the path or a condition ties access to an owner. The [rules basics page](https://firebase.google.com/docs/rules/basics) shows the owner form: `request.auth.uid == userId` on a `users/{userId}` path. Use it for private files.
- Do Storage rules filter folders in a listing?
- Rules are not filters. The [core syntax page](https://firebase.google.com/docs/storage/security/core-syntax) says `read` splits into `get` and `list`, and `list` rules need Rules Version 2. If your rule allows `list` on a path, a client can ask for the file names there. Allow `list` only where you mean it, and test a list call as a different user.
- Can I check my Storage rules without the Emulator Suite?
- Yes, for a first pass. The Rules Playground in the Firebase console runs a simulated read or write as unauthenticated, anonymous or a chosen user ID, and reports allowed or denied, per the [Rules Playground page](https://firebase.google.com/docs/rules/simulator). The docs recommend the emulator for fuller testing, because it can run automated tests on your machine before you deploy.
You just read what AI builders ship. Now check yours.
Paste your GitHub URL. 2 minutes. You get the findings in plain English, and the report says what it could not check. Free, no card.
Scan My App Free