In PocketBase, an empty rule means everyone.
Updated 2026-10-14 · Plain English, written for founders who built with Lovable, Bolt, Cursor or similar.
Every PocketBase collection has five API rules: List/Search, View, Create, Update and Delete. Each one can be in one of three states, and the difference between two of them is easy to miss:
null(shown with a lock in the dashboard): only superusers can do this. Regular API calls are refused.""(an empty string): anyone can do this, logged in or not.- A filter, such as
@request.auth.id != "" && user = @request.auth.id: only requests that match it.
So clearing a rule box in the dashboard does not remove access. It opens that action to the whole internet. An empty List rule on a users, orders or messages collection lets anyone page through every record; an empty Update or Delete rule lets anyone change or remove them.
Check from the outside
This is what a stranger does. Open your live app, open DevTools, and search the loaded JavaScript for new PocketBase( to find your server URL, and for .collection( to find collection names. Then list one record without logging in:
curl "https://api.yourapp.com/api/collections/orders/records?perPage=1"
200with records initems: anonymous visitors can list this collection.totalItemstells you how many they can see.200with"items": []: nothing is visible to an anonymous visitor. Either a filter rule hides the records, or the collection is empty.403: the List rule is locked to superusers. Good, if your app does not need to list it.404: wrong collection name; try the names your code uses.
This only tests listing. Open the collection in the dashboard to see the View, Create, Update and Delete rules too.
Only do this against your own server.
Fix it in the dashboard
Open the collection, click the settings (gear) icon, and go to API Rules. For a collection where each record belongs to one user through a user relation field:
List/Search: @request.auth.id != "" && user = @request.auth.id View: @request.auth.id != "" && user = @request.auth.id Create: @request.auth.id != "" && @request.body.user = @request.auth.id Update: @request.auth.id != "" && user = @request.auth.id && @request.body.user:isset = false Delete: @request.auth.id != "" && user = @request.auth.id
- The Create rule checks the incoming data. Without
@request.body.user = @request.auth.id, a user can create records that claim to belong to someone else. - The Update rule stops owners changing hands.
@request.body.user:isset = falserefuses any update that tries to set theuserfield. - Leave a rule locked if the app never needs it. If only your admin deletes records, keep Delete as
nullrather than writing a filter. - Click the lock to set superusers only. Deleting the text in the box gives you
"", which is public.
Fix it in a migration
If you keep your schema in pb_migrations, add a new migration so the fix is in version control and every environment gets it. For PocketBase v0.23 and later:
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const orders = app.findCollectionByNameOrId("orders");
const owner = '@request.auth.id != "" && user = @request.auth.id';
orders.listRule = owner;
orders.viewRule = owner;
orders.createRule = '@request.auth.id != "" && @request.body.user = @request.auth.id';
orders.updateRule = owner + ' && @request.body.user:isset = false';
orders.deleteRule = null; // superusers only
return app.save(orders);
});
Migrations run in order and the last one to set a rule wins, so an older migration with an empty rule is fine once a newer one replaces it. Make sure the newer one is deployed.
What SecureIndie checks
- On your live site: when your site's code names its PocketBase URL and that server is on your site's own domain or a subdomain of it, one anonymous, read-only list request for up to five collections your code names. Only record ids are requested, and none are kept. A PocketBase server hosted elsewhere is not tested, because the scan cannot tell it is yours.
- In your repo, when you connect it: the API rules in
pb_migrationsor apb_schema.jsonexport, with the latest migration taking precedence.
After the fix
- Re-run the curl from above. It should return
"items": []or403. - Sign in as one test user and try to view a second test user's record by id. It should return 404.
- If the collection held personal data while it was open, read what to do if data leaked.
Check your app
SecureIndie looks for this mistake. The free quick check covers the basics from outside (exposed files, keys in your site's code, headers) in about a minute. Database rules, payment webhooks and AI endpoints need the full audit, which also reads your code and proves what a visitor can actually reach.
Questions
Why is an empty rule public instead of locked?
PocketBase uses null (shown with a lock in the dashboard) for superusers only, and an empty string for no restriction at all. Clearing the box looks like removing access but actually grants it.
Does a list rule hide records or block the request?
For listing it works as a filter: records that do not match are left out and the request still succeeds. That is why an owner-only list rule is safe to use on a shared collection.
Can the dashboard login be used from my frontend?
No. Superusers skip every API rule, so a superuser email and password in client code is a full database login. Use a normal auth collection for your app's users.
Related guides
- Your Firestore rules may let anyone read everything.
- Supabase RLS is off. Anyone can read that table.
Checks covered: PB-RULES-001, PB-LIVE-002 · If you think data already leaked