## TL;DR

Write storage rules that validate the file, not just the user: cap request.resource.size, restrict request.resource.contentType to the types you expect, and do not grant delete to clients unless the feature needs it.

## Steps

1. Write storage rules that validate the file, not just the user: cap request.resource.size, restrict request.resource.contentType to the types you expect, and do not grant delete to clients unless the feature needs it. Test the rules against the emulator with adversarial uploads before publishing.

## When to use

You are seeing this: Test the rules against the emulator with adversarial uploads before publishing. Use this skill when you run into "Firebase Storage rules should validate size and type, not just auth".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
