How to Keep Each Customer’s Supabase Data Separate
Your app can have a working login and still show one customer another customer’s records. Learn the Supabase rule to check, how to test it safely, and what to ask your AI builder.
before you start
A working login identifies the customer. A separate Supabase rule must limit which customer information that person can view or change.
A working login can still show the wrong customer’s information
in plain words
Signing in tells the app who someone is, but it does not automatically limit every piece of stored information that person can receive.
Imagine that you used an AI builder to make a customer portal. Maya signs in to view her orders, while Leo signs in to view his. The pages look correct because each screen displays only the expected name. However, the place where Supabase stores the information may still be willing to send both customers’ orders. Developers call that storage system a database. Inside it, information is organized into groups called tables, and each saved item is called a record or row.
Filtering a page is not the same as refusing the wrong record. A future update, a newly generated screen, or a mistake in an AI-created request could display a customer’s name, address, order, support message, or internal note to someone else. The stronger approach is to make Supabase check every record before allowing it to be read or changed. The technical name is Row Level Security, commonly shortened to RLS. It applies rules at the individual-record level instead of trusting only what the visible page chooses to show.
This matters because customers use the real app in ways that a preview may not cover. They may open an old bookmark, use two tabs, return after an update, or press a button connected to the wrong stored information. If Supabase itself rejects records belonging to another person, a screen mistake is less likely to become a customer-data mistake. This protection must be configured and tested; having a login button does not create it automatically, and reading this guide does not prove that it is working in your app.
- ▸Use invented names and unmistakable records, such as Maya Test Order and Leo Test Order.
- ▸Check each action separately because viewing may be restricted while editing or deleting is still too broad.
common risk
The orders page displays only Maya’s orders, but the request behind that page receives every order and merely hides the others. A later screen change could display Leo’s address or order details.
what to do now
Create two test accounts in a separate testing version of the app. Give each account one clearly named invented record, and do not use real customer information or real payment keys.
ask your AI
Inspect my Supabase setup without changing anything. Explain in beginner-friendly language which stored groups contain customer or business information, whether protection is enabled for each one, and whether a signed-in customer could receive another customer’s records. Use no real customer data, make no changes to the live app, and give me a review plan before proposing any commands.
Connect every customer record to the person who owns it
in plain words
Supabase needs a dependable label on each customer record so it can decide whether the signed-in person is the owner.
For every customer-owned order, project, appointment, note, or uploaded request, save a stable identifier for its owner. The technical name for this identifier is a user ID. Think of it as a label that says which signed-in account owns the record. Names and email addresses are poor ownership labels because two people can share a name and an email address can change. The user ID supplied by Supabase when someone signs in is designed to remain a dependable match.
The ownership rule can then be written plainly: a person may read or change a record only when the record’s owner ID matches that person’s user ID. A written database rule that allows a particular action is technically called a policy. Separate policies can cover reading, creating, editing, and deleting. This separation matters because the right business behavior may differ: a customer could create a support request and read it later, but might not be allowed to erase it after staff has responded.
Existing records need attention too. Turning on a rule does not magically add the correct owner to old information. If an older record has no owner ID, do not guess or make a bulk change in the live app. First produce a list of affected records using invented or safely prepared testing data, decide how ownership can be verified, and plan the change with your AI builder or developer. Staff-wide access should also have its own narrow, documented rule instead of being mixed into ordinary customer access.
- ▸Confirm that every customer-owned group has an owner ID field and that new records receive the signed-in person’s ID.
- ▸Document records without an owner and plan their correction before changing live customer information.
common risk
A notes table connects records only by email address. After a customer changes email or an AI-generated filter uses the wrong address, notes can be attached to the wrong account.
what to do now
Make an inventory with four items for each group of stored information: what it contains, who owns each record, how the owner is identified, and whether staff need a separate rule.
ask your AI
Review my Supabase structure without applying changes. Identify every group that contains customer-owned information, show which field identifies the owner, and flag missing, optional, or unreliable owner IDs. Propose a non-destructive correction and testing plan for old records. Do not guess ownership, do not use real customer information in examples, and do not alter the live app.
Allow only the actions each person genuinely needs
in plain words
Start by refusing customer records, then add small rules for the exact actions your customers and staff must perform.
When RLS is enabled for a table, Supabase can refuse actions unless a matching policy permits them. Write the intended behavior in ordinary language before asking AI to produce a rule. For example: customers may read their own profile, update their own phone number, create their own support request, and never delete billing history. Then compare that statement with the actual policies. A rule that allows every signed-in person to use every record defeats the purpose, even if it removes an error message.
Creation needs a careful check. A customer should not be able to claim that a new record belongs to someone else by supplying a different owner ID. The creation policy should verify that the saved owner ID matches the person who is currently signed in. Editing should also prevent someone from changing an existing record’s owner. Ask your AI builder to explain both checks in plain language and to show proposed changes for review before applying them in a separate testing version.
Some Supabase keys can open far more information than an ordinary customer should reach. One especially powerful key can bypass these normal record rules; its technical name is a service role key. Keep it, along with payment keys, passwords, and access codes, only in the protected part of the app that visitors cannot download. Developers call that protected part the backend. Files delivered to a visitor’s web browser, the program used to open websites, must never contain these powerful keys. Use Supabase’s customer-facing key only as intended and rely on tested record rules for protection.
- ▸Compare separate rules for reading, creating, editing, and deleting instead of assuming one rule covers everything safely.
- ▸Investigate a refusal before widening a rule; do not allow every signed-in customer merely to make a screen work.
common risk
An AI builder fixes a failed orders screen by adding a policy that lets every signed-in customer read all order records. The screen works, but customer separation has been removed.
what to do now
Choose one important table and write exactly who may read, create, edit, and delete each kind of record. Compare those decisions with its enabled policies in a separate testing version.
ask your AI
Review every enabled Row Level Security policy in my Supabase project without changing it. For each table, explain who can read, create, edit, and delete records. Flag rules that allow all signed-in users, creation with another person’s owner ID, changing a record’s owner, or use of a service role key in files visitors receive. Propose the smallest corrections and a safe test plan, but do not apply changes or use production customer data.
Test with two accounts after every important app update
in plain words
The clearest practical check is to confirm that one test customer cannot view or change the other test customer’s records.
In a separate testing version, sign in as Account A and create an invented record. Confirm that A can perform only the intended actions. Sign out fully, sign in as Account B, and try to find, open, edit, and delete A’s record through the same screens customers use. Also confirm that B can create and use its own record. Record the expected and observed result for every action. A hidden button is not enough; Supabase must refuse the unwanted action even if a screen is connected incorrectly.
Repeat this test after adding a table, changing sign-in behavior, creating a staff page, changing a policy, or asking AI to build a new customer feature. Test the live update process only after the separate testing version behaves correctly. Do not copy real customer information, payment keys, or passwords into test prompts. A successful two-account test provides useful evidence for the paths you checked, but it does not guarantee that every screen, rule, or unusual situation is safe.
VibeCodeWall’s free public check examines what the public app exposes; it does not see private source code or confirm that every Supabase policy is correct. Ongoing Pro monitoring is a separate capability that must be activated. It uses the technologies and versions that have actually been inventoried, so missing inventory limits its coverage. That monitoring can complement your two-account checks by watching relevant public exposure over time, but it does not replace direct testing of customer-data separation or automatically repair a faulty policy.
- ▸Save the expected and actual result for both accounts so the same check can be repeated after updates.
- ▸If a test fails, correct it away from the live app and rerun the entire two-account check before updating customers.
common risk
A new staff page showing all support requests is added for convenience, but an ordinary customer can open it and see other customers’ names and messages.
what to do now
Add the two-account check to your update routine whenever work affects Supabase, sign-in, customer pages, staff pages, or stored information. Begin with the most sensitive customer table today.
ask your AI
Create a step-by-step two-account test for my current Supabase app without making changes. Use two invented users and invented records only. Cover reading, creating, editing, deleting, changing an owner ID, ordinary customer screens, and staff-only screens. For every step, state the expected result and what evidence I should record. Keep all work in a separate testing version and stop if the test could affect live customer data.
Quick checklist
- 01List every place that stores customer or business information.
- 02Create two test accounts with clearly different invented records.
- 03Check viewing, creating, editing, and deleting separately.
- 04Confirm that every customer record is connected to its owner.
- 05Review the rules whenever your AI builder adds stored information.
- 06Keep powerful Supabase keys, payment keys, passwords, and access codes outside files visitors receive.
- 07Test changes in a separate testing version before updating the live app.
- 08Treat public checks as useful evidence, not proof that customer records are separated correctly.
FAQ
Is a working login enough to separate customer records?
No. Login identifies the person. Row Level Security policies tell Supabase which records that person may read or change, and those policies still need review and testing.
Should every Supabase table have these rules?
Review every table. Any table containing customer, account, order, payment, staff, or other business information needs an explicit decision. Document any exception and why it is safe.
Can the powerful Supabase key be placed in files visitors receive?
No. A service role key can bypass normal record rules. Keep it in the protected backend, which is the part of the app visitors cannot download, and never place it in browser-delivered files.
Does a two-account test prove the whole app is safe?
No. It directly checks the situations you tested and can catch important mistakes, but it is not a guarantee. Repeat it after relevant updates and combine it with broader review and public monitoring.