Premium

Real-Time Chat App

A query filter is a convenience, not a security boundary — nothing stops an attacker sending the unfiltered read instead.

  • Flutter
  • Dart
  • Firebase

About this project

A real-time one-to-one chat app in Flutter — email sign-up, a room list, live message streams, and read state — backed by Firebase Auth and Cloud Firestore.

The app's own UI only ever asks Firestore for messages in one room at a time, filtered by roomId. That filter makes the app work, and it makes the naive developer confident: they test the shape their UI sends, see the right messages come back, and ship. But a filter in a query is a convenience for the client, not a rule the database enforces — an attacker does not have to use the app at all. They send the unfiltered read, and under a naive ruleset every private message in the entire collection comes back. This project proves it: three real Auth-emulator users, one private room, and an outsider who reads both participants' messages under the naive rules and is blocked by HTTP 403 under the fixed ones — while the real participant's own scoped read still works. The fix checks room membership against the stored room document, which the client cannot forge.

What you will learn

  • Understand why a client-side query filter can never be a security control
  • Write Firestore rules that check room membership on the stored document, not the request
  • Prove a rules fix by sending the same unfiltered read an attacker would, not just the app's own query
  • Structure a Flutter app behind service interfaces so its tests need no real Firebase
  • Apply the same "filter is not a boundary" lesson to any list-scoped API endpoint

Before you start

  • Flutter and Dart basics — widgets, state, and streams
  • Flutter SDK 3.x — no paid Firebase project needed, the local emulators do everything
  • Firebase CLI for the security-rules proof

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.