How to Test an AI App’s Database and Login With Two Accounts

Run a two-account test for saved records, private reads, denied writes and logout. Copy the evidence worksheet and rerun the checks on your release URL.

By Uvilno · 5 min read · Published

Read as Markdown

Use two accounts and the same private record

A useful database and login test has two halves. Visitor A saves a private record and gets it back after a fresh load. Visitor B signs in successfully, sees their own record and cannot read or change A’s record even when they have its exact identifier. Use the same A record for the permitted and denied requests so a typo, stale ID or broken endpoint cannot produce a misleading pass.

Run this on an app you own or have permission to test. Use a staging deployment, two disposable visitor accounts and fictional records you can remove afterward. OWASP calls a missing permission check on an individual record broken object-level authorization. The service must decide whether the current account can perform the requested action on that record. Apply the same permission check when an ID is hard to guess or the UI hides the action.

Set up independent browser sessions

Record the deployment URL and version before touching data. Open A and B in separate browser profiles and keep a third session signed out. Tabs in the same profile can share login state. Use ordinary visitor access, and confirm the app shows the expected account in each session. Check that both sessions point to the same deployment and data environment.

As A, create two private records named QA-A-read and QA-A-delete. Use the first to test reads and updates, and the second for the delete attempts. As B, create QA-B-read. Save the record links or identifiers exposed by your app, then verify each one works for its owner. If your app also has a public catalog, pick one intentionally public record as a separate control. Write down any intentional shared access before you run the matrix.

Run the allow and deny checks

Use the app’s normal screens first. For the known-ID checks, open the same detail URL as the second visitor. If the UI offers no direct route, use your own app’s documented data client or an integration test with B’s ordinary session and A’s exact record ID. Avoid copying A’s session into B’s test. A UI route that shows an empty shell can still make a request that returns private data, so inspect that response in the browser’s Network panel or assert on it in a test.

A denial can be a forbidden response, a missing-record result or an empty list, depending on the app’s contract. Confirm the result contains no protected fields. For a denied write or delete, reopen the record as A and verify its value and existence. A failure toast alone says little about what the database committed. Mark a provider outage, timeout or wrong environment inconclusive, then rerun once you can establish the expected session.

Scroll sideways for all columns.

Private-record release checks for an ordinary visitor
ActionWhoExpected result
Edit QA-A-read, reload and reopenAThe acknowledged edit persists
List records and open QA-B-readBB’s record appears and A’s records are absent
Request QA-A-read by A’s known IDBNo private record or fields are returned
Attempt to update QA-A-readBA reloads and sees the original saved value
Attempt to delete QA-A-deleteBA reloads and can still open the record
Submit a missing required fieldAThe app rejects the submission and saves no new row
Delete QA-A-delete and reloadAThe authorized deletion persists
Reopen A’s record URL after logoutSigned outPrivate content stays unavailable after reload

Save evidence you can rerun after a fix

Capture one row per action. Keep the request method and route shape when that helps identify the failure, along with the returned status, the visible outcome and the owner’s before-and-after result. Redact access tokens, cookies, credentials and personal information. If a check fails, correct the relevant authorization or persistence path, then repeat both the permitted and denied checks against the same test record. Rerun the checks with disposable data on the actual release URL before inviting visitors, then remove the test records.

Copyable evidence worksheet
Version / URL / date:
Scenario / actor / record alias:
Action / request method and route shape:
Expected result:
Observed response / visible outcome:
Owner state before and after reload:
Result (pass / fail / inconclusive):
Fix, version and rerun result:

Map the test to the authorization layer you use

In Uvilno, test with real app visitors and a private collection. The app’s managed data client supports list, get, create, update and remove. Studio’s App Data view can help the project owner confirm a committed row. Use the preview role selector to check layouts and actual app sign-ins to check visitor permissions. Repeat the provider flow on the published host you intend to share.

In a Supabase-backed app, check each operation against the table’s grants and row-level security policies using a regular user session. A service-role key can bypass row-level security, which makes it the wrong credential for the visitor-side matrix. In Base44, translate the cases to the table’s configured Read, Update and Delete permissions. The expected owner and non-owner results stay the same across those setups for a private record.

In Uvilno’s local database fixture, a visitor attempted to remove a second visitor’s row by its known ID and received a record-not-found error. A separate route fixture rejected private reads without app identity and requests with caller-supplied privilege flags. These are checks of the data and API boundaries. Run the browser matrix to verify the screens and provider flow of your own deployment.

Rerun the local database and route fixtures from the repository
pnpm --filter @wb/web exec vitest run src/server/workspace/entities-db.test.ts src/server/workspace/entities-routes.test.ts

Common questions

Do I need a third account to test logged-out access?

A signed-out browser session is enough. Verify that a private route and its underlying record request expose no private content. Sign out as A as well and reload a previously accessible route to test the logout path.

What if my app deliberately shares records with a team?

Write the expected permissions first. Add one permitted teammate and one account outside the team. Check each operation separately, since permission to read a record can differ from permission to edit or delete it.

Does passing this matrix establish that the entire app is secure?

The results apply to the routes, actors and actions you exercised. Extend the matrix to additional collections, attachments, staff roles and integrations as your product adds them.

Prepare your own brief

Adapt this starting point to your project. You can name the project and review the text before you explicitly send a build.

Name your project and review the brief. Building starts when you send it.

Check the architecture. Compare the tradeoffs.

Follow the data model, account boundary and source handoff before choosing a builder.