We built an AI chatbot for websites called Botly Pro. In November, we ran our own security tool against it, and it found that anyone on the internet could read our customers' chatbot data straight from Firestore. Then, after we fixed that, it found that they still could.
Both issues are fixed. Here's what went wrong, because both mistakes are easy to make in any Firebase app.
The setup
The chatbot widget runs on our customers' sites. When a visitor opens a page, the widget loads that bot's published configuration straight from Firestore, using the project's public web config.
That's normal for Firebase, but it means the API key and project ID ship in every page. The security rules are the only thing between the internet and your data.
Each bot's document held its public settings and, in the same document, its knowledge base: the text from the customer's site that the AI answers from. The rule was:
match /botly_configs/{botId} {
allow read: if true;
}
We meant "anyone who knows a bot's ID can load it."
Mistake 1: read means get and list
read is shorthand for two operations:
get: fetch one document by its ID.
list: run queries, including "give me everything".
We meant to allow the first and allowed both. With no account, one request returned every bot in the project:
GET https://firestore.googleapis.com/v1/projects//databases/(default)/documents/botly_configs?pageSize=100
→ 200 OK
That covered every configuration, knowledge base, and licence record in the project.
The fix took one line:
match /botly_configs/{botId} {
allow get: if true;
allow list: if isAdmin();
}
Mistake 2: a field mask isn't a permission
We re-tested that afternoon. Listing was blocked. But the widget loads a bot like this:
GET .../documents/botly_configs/{botId}?mask.fieldPaths=config
The mask asks for only the config field, the public part. The client chooses the mask, so an attacker just leaves it off and gets the whole document, knowledge base included. Every bot ID sits in the embed snippet on its customer's site, so anyone visiting a customer's site could read the knowledge base behind it.
Firestore rules decide whether a document can be read. They can't hide some of its fields. Once get is allowed, every field comes with it.
The fix was to split the data by who may read it:
// Public: only what already ships in the embed snippet
match /botly_configs/{botId} {
allow get: if true;
allow list: if isAdmin();
}
// Private: no browser may read it; only the backend (Admin SDK) and admins
match /botly_knowledge/{botId} {
allow read: if isAdmin();
}
Check your own project
Find your project ID in your web app's Firebase config, then run these without signing in. Only test projects you own.
- Can anyone list a collection?
curl -s -o /dev/null -w "%{http_code}\n" \
"https://firestore.googleapis.com/v1/projects/YOUR_PROJECT/databases/(default)/documents/YOUR_COLLECTION?pageSize=1"
200 means anyone can enumerate it. You want 403, unless the collection really is meant to be public.
- Does a "public" document carry private fields?
curl -s "https://firestore.googleapis.com/v1/projects/YOUR_PROJECT/databases/(default)/documents/YOUR_COLLECTION/SOME_ID" \
| python3 -c "import sys,json; print(sorted(json.load(sys.stdin).get('fields', {})))"
If you see a field you wouldn't show a stranger, move it to a document that only your backend or the owner can read.
- Read your rules for these patterns:
allow read: if true where you meant "fetch by ID". Use allow get and keep list locked.
allow read: if request.auth != null on one user's data. Anyone can sign up, so check ownership instead, for example resource.data.ownerUid == request.auth.uid.
Relying on select(), mask.fieldPaths or "the app never asks for that field." Your app may not ask for it, but an attacker can.
Takeaways
Nothing looked wrong. Every screen worked. The exposure was in a path no user takes: talking to the database directly.
Put data for different audiences in different documents. Rules can't split one document.
Re-test after you fix. Our first fix closed one hole and left the other open.
The full write-up, with the timeline and the before-and-after checks on the live project, is on our site: RedSuture research.
Disclosure: I build RedSuture, the AI pentesting tool that found both issues.

