Premium

E-Commerce App (Flutter)

There is no server to fall back on — when the client talks straight to Firestore, the rules file IS the entire trust boundary.

  • Flutter
  • Dart
  • Firebase

About this project

A Flutter storefront — product catalogue, cart, checkout, order history — backed entirely by Firebase Auth and Cloud Firestore, with no backend server of its own. That architecture is common, convenient, and exactly where the danger lives.

With no server in the middle, every write goes straight from a phone to the database. Whatever validation the app does in Dart is a suggestion an attacker simply skips — they send the HTTP request themselves. That makes firestore.rules the entire trust boundary, not a second layer behind one. This project ships two rulesets and a real demo script that fires identical HTTP requests at both, against a real Firestore emulator: under the naive rules, a Rs 1,499 kettle is bought for one paisa, one user reads and overwrites another's order, a negative quantity produces a negative order total, and an arbitrary unchecked field persists. Under the fixed rules, every one of those is rejected while the legitimate order still goes through — because the fixed rules read the real price off the product document with get(), and restrict every order to exactly the fields the app actually writes.

What you will learn

  • Understand why a serverless client app makes firestore.rules the whole trust boundary
  • Validate a price server-side by reading the real product document, never the write request's claim
  • Write rules that restrict the exact field set a document may contain, not just its values
  • Prove a security fix by running the identical requests against both a naive and a fixed ruleset
  • Reuse the same "validate against stored truth, not client input" pattern in any BaaS-backed app

Before you start

  • Flutter and Dart basics — widgets, state, and async/await
  • Flutter SDK 3.x — no paid Firebase project needed, the local emulators do everything
  • Node 18+ to run the security-rules demo tooling

Academic integrity notice

These projects are provided for learning, experimentation and reference. Understand the code, modify it for your own requirements, and acknowledge external work according to your institution’s academic policies. Priodemy does not supply work to be submitted as your own.