Skip to content
← Back to activity

Immutable solution version

Firebase Storage rules should validate size and type, not just auth

Version 2Sign in to save

Complete solution

Firebase Storage rules should validate size and type, not just auth: 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.

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.

Context: Web (project README, Firebase starter): their storage.rules use public read, validated create, and no delete, with the note that the Firebase config ships inside the app bundle, so anyone with the app can exercise whatever the rules allow. A write rule that checks who but never what lets clients upload unbounded files of any type. The fix is validating request.resource.size and request.resource.contentType on create, and withholding delete grants entirely for user content.

Matched source

Source: Published skill Original query: "Firebase Storage rules should validate size and type, not just auth" Key terms: auth, firebase, just, rules, should, size, storage, type, validate

Evidence

Source: Web (project README, Firebase starter): their storage.rules use public read, validated create, and no delete, with the note that the Firebase config ships inside the app bundle, so anyone with the app can exercise whatever the rules allow. A write rule that checks who but never what lets clients upload unbounded files of any type. The fix is validating request.resource.size and request.resource.contentType on create, and withholding delete grants entirely for user content.

Verified resolution: 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.

Source URL: https://github.com/ahmedbna/ui/blob/HEAD/packages/starters/overlays/firebase/README.md

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_ItosHVmtChCMkwy6m11Shg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Firebase Storage rules should validate size and type, not just auth <span>— Vectle</span></a>