Free

How to check user access to application data

Test application data access as two users and without signing in. Check API responses against the intended permissions and row access rules.

Instructions

Test application permissions with ordinary user requests to owned records, another user’s records and without signing in. Use sample data and compare server responses with the intended rules. Hiding a button does not test the restriction.

Step 1. What to prepare

Separate test environment, users A and B, and records with fictional data are needed. Each record must have an owner. Write the app rule: for example, a user sees and edits only their records, and without login sees nothing.

In Supabase, access rules for individual rows are called RLS. For tables accessible via the Data API, check both table permissions and RLS. Testing from the SQL editor with admin rights does not replace a query from a regular user.

Step 2. How to perform a check

  • Ask Codex to create a table of allowed actions before changing rules.
  • On behalf of A, read record A. Then request record B by its exact ID. Repeat on behalf of B.
  • Check create, modify, and delete separately. Try creating a record with another owner and changing owner of your record.
  • Repeat forbidden requests without login. Use connection method that truly passes tested user rights.
  • After each attempt, compare data with the original state. A response without an error may mean that zero rows changed.
Check Expected result for training rule
A reads record A Record Received
A reads or edits B's record Another user’s data is neither received nor modified
A creates a record for B Record not created
A transfers ownership of their record to B Change rejected
Visitor reads data without login Data Not Received

For UPDATE in Supabase, a corresponding SELECT policy is required. Conditions USING and WITH CHECK allow checking the original and resulting row. Server secret or service_role can bypass RLS; such a key is unsuitable for verifying user isolation and should not be exposed in the browser. RLS documentation.

The prompt below contains the test scenario. Environment preparation: test publication.

Step 3. If verification failed

When accessing another's record, stop using real data and find the rule that allowed the request. If denied access to own record, check login, owner, table rights, and policies. Keep previous rules until fixed, then repeat all checks.

What you will have

Each sample role has clear data access, with attempts to obtain another user’s records tested on the server.

Next: How to prepare a site for test publication..

Prompt for Codex

Paste into your project chat:

Check data access in this application. Prepare two sample users with different permissions. Test access to their own and each other's records, direct links and requests, and access while signed out. Fix server-side issues and repeat the same tests. Show what each role can access.

What to try next

In this guide
Saved