How I Would Fix database rules leaking customer data in a Bolt plus Vercel internal admin app Using Launch Ready.
The symptom is usually simple: an internal admin app shows records that should be hidden, or a user can see another customer's rows after logging in. In a...
How I Would Fix database rules leaking customer data in a Bolt plus Vercel internal admin app Using Launch Ready
The symptom is usually simple: an internal admin app shows records that should be hidden, or a user can see another customer's rows after logging in. In a Bolt plus Vercel stack, the most likely root cause is bad authorization at the data layer, not the UI. The first thing I would inspect is the database access path: which client is querying the data, what auth context it sends, and whether the rules actually enforce tenant or role boundaries.
For an internal admin app, this is a business risk, not just a bug. It can expose customer data, create compliance problems, trigger support escalations, and force you to pause launch or revoke access while you clean up the mess.
Triage in the First Hour
1. Check the latest production logs in Vercel.
- Look for requests hitting admin routes with unexpected response sizes.
- Flag any endpoints returning full tables, broad selects, or repeated 200 responses for unauthorized users.
2. Inspect the database audit trail.
- Confirm which user IDs accessed sensitive tables.
- Look for reads from accounts, orders, notes, invoices, or CRM objects outside the expected tenant.
3. Review the auth flow in the app.
- Verify whether the session is present on every request.
- Check if Bolt generated any client-side direct DB calls that bypass server checks.
4. Open the database rules or policies.
- Confirm there are explicit row-level restrictions by tenant_id, org_id, or owner_id.
- If policies are missing or too broad, assume leakage until proven otherwise.
5. Check environment variables in Vercel.
- Make sure production secrets are not exposed to client bundles.
- Verify there is no admin key shipped to the browser.
6. Inspect recent builds and deployments.
- Identify when the leak started and whether it correlates with a new release.
- Roll back if needed before making code changes.
7. Review admin screens for bulk data fetches.
- Look for pages loading entire collections instead of scoped queries.
- Pay attention to exports, search pages, and dashboards that aggregate customer records.
8. Confirm who can access the app itself.
- Check Vercel preview links, password protection, and any shared staging environments.
- Internal apps often leak through preview URLs long before they leak through code.
## Quick diagnosis: check whether production env vars are present only server-side vercel env ls vercel logs <project-name> --since 1h
Root Causes
| Likely cause | What it looks like | How I confirm it | |---|---|---| | Missing row-level security | Any authenticated user can read all rows | Query policies and test with two different user accounts | | Overbroad policy | Policy uses `true`, `is_authenticated`, or weak role checks | Read policy logic line by line and compare against tenant model | | Client-side direct DB access | Browser calls DB with elevated credentials | Search code for public keys, service keys, or direct SDK usage in UI code | | Broken tenant scoping | Queries do not filter by org_id or customer_id | Inspect query builders and network requests for missing filters | | Admin role confusion | All logged-in users get admin rights by mistake | Trace role assignment from auth provider to session claims | | Stale preview or staging exposure | Old build still serves sensitive data publicly | Compare current production deployment with preview URLs and cached assets |
The most common failure I see is a product built fast in Bolt where auth was added later as a visual layer instead of as a hard rule at the database boundary. That creates a false sense of safety because the UI looks restricted while the API still returns everything.
The Fix Plan
My approach is to stop leakage first, then tighten the design without breaking production more than necessary.
1. Freeze risky writes and reads temporarily.
- If data exposure is active, I would disable export buttons, bulk views, and any route that returns wide datasets.
- If needed, I would put a temporary maintenance gate on admin access while keeping core operations available.
2. Move authorization enforcement to the server or database.
- Every sensitive query must be scoped by tenant_id or equivalent ownership field.
- I would not rely on hidden buttons or front-end conditionals as security controls.
3. Replace broad queries with explicit scoped queries.
- Example: fetch only records belonging to the signed-in organization.
- Remove any `select *` patterns from sensitive tables if they are feeding admin screens.
4. Audit database rules and make them deny-by-default.
- Allow read access only when the authenticated user belongs to that record's tenant or has an explicit admin claim.
- Separate support staff permissions from super-admin permissions.
5. Move privileged operations behind server functions.
- Exports, impersonation tools, billing changes, and customer edits should run through protected server routes or functions on Vercel.
- The browser should never hold privileged credentials.
6. Rotate secrets if anything was exposed.
- If an admin key or service token was shipped to clients or preview builds, rotate it immediately.
- Then remove it from all client-visible bundles and redeploy cleanly.
7. Add monitoring before reopening access.
- Track unauthorized response spikes, unusual row counts per request, and failed auth attempts.
- Set alerts for sudden jumps in records returned from admin endpoints.
8. Ship with least privilege everywhere else too.
- Use separate credentials for read-only dashboards and write operations.
- Keep production secrets out of local files committed into Bolt-generated code.
A safe repair usually takes one focused sprint rather than a giant rewrite. For most founder teams I would aim for 1 day of containment plus 1 day of cleanup and verification under Launch Ready's 48-hour window.
Regression Tests Before Redeploy
I would not redeploy until these checks pass:
1. Tenant isolation test
- User A cannot read User B's records through UI or API.
- Acceptance criteria: 0 cross-tenant rows returned in manual testing and automated tests.
2. Role separation test
- Regular admins cannot access super-admin actions like exports or impersonation unless explicitly allowed.
- Acceptance criteria: forbidden actions return 403 every time.
3. Direct API test
- Hit sensitive endpoints without a valid session and confirm they fail closed.
- Acceptance criteria: no unauthenticated reads succeed.
4. Preview environment test
- Verify preview deploys do not expose production data sources unless intentionally configured for safe staging data only.
- Acceptance criteria: preview uses isolated credentials and sandbox data.
5. Secret exposure check
- Confirm no service keys exist in client bundles or public environment variables.
- Acceptance criteria: secret scan returns zero high-risk findings.
6. Smoke test on core screens
- Load dashboard, search page, detail page, export flow, and edit flow with two roles.
- Acceptance criteria: all screens render correctly without leaking extra rows.
7. Audit log review
- Confirm sensitive reads are logged with user ID, route name, timestamp, and tenant context where appropriate.
- Acceptance criteria: logs are readable enough to investigate but do not store raw secrets or PII beyond policy limits.
For QA coverage here I want at least 80 percent on authorization-related logic and 100 percent coverage on critical denial paths. If you cannot automate everything yet, I would still require manual verification across two separate accounts before release.
Prevention
The fix should change how you build future admin features too.
- Put security checks at the data boundary first.
Never trust front-end gating alone for internal tools.
- Add code review rules for sensitive queries.
Every query touching customer tables should show tenant scoping in review comments before merge.
- Use deny-by-default policies everywhere possible.
It is much easier to open one safe path than close ten accidental ones later.
- Separate environments cleanly.
Production data should never be reachable from previews unless there is a very controlled exception process.
- Log access patterns that matter business-wise.
Track who viewed what and when so you can spot abnormal support behavior early without overlogging private content.
- Protect internal apps like public ones anyway.
Add Cloudflare protection where relevant, set strong headers on Vercel deployments, keep SSL enforced, and monitor uptime so broken auth does not become broken availability too.
- Keep UX honest about permissions.
If someone cannot act on a record because of their role, show that clearly instead of hiding errors behind vague empty states that confuse support teams later.
- Review performance at the same time as security.
Overfetching entire tables makes leaks worse and also hurts load times; I would target sub-2 second p95 page loads on key admin views after cleanup.
When to Use Launch Ready
Launch Ready fits when you need me to stop leakage fast and get the app back into a safe launch state without dragging this into a multi-week rebuild. No - for this case I use the same sprint structure focused on deployment safety: DNS sanity checks if relevant to your stack edge setup anyway? More importantly I cover production deployment hygiene around secrets, monitoring paths if you need them tightened during handover alongside Cloudflare-style protections where applicable to your domain setup flow overall package context includes DNS redirects subdomains Cloudflare SSL caching DDoS protection SPF DKIM DMARC production deployment environment variables secrets uptime monitoring and handover checklist within that sprint scope when we are hardening launch readiness around Vercel-hosted apps too because leaked data often travels with bad deployment hygiene across previews prod settings email configs etcetera
Use this sprint if:
- You already have a working Bolt app but auth rules are shaky,
- You need production-safe deployment within 48 hours,
- You want one senior engineer to fix leakage risk without turning it into a redesign project,
- You need clear handover notes so your team does not reintroduce the same bug next week.
What you should prepare:
- Access to Bolt project files,
- Vercel project owner access,
- Database console access,
- Auth provider access,
- A list of roles such as owner, manager, support agent,
- Two sample test accounts with different permissions,
- A short description of what each role should see and not see,
- Any compliance requirements tied to customer data handling.
If you bring me those inputs early in day one morning UTC time zone aligned? then I can usually isolate root cause within hours instead of guessing across disconnected tools. The goal is simple: stop exposure first; then ship an internal admin app that behaves like one meant to hold customer data safely rather than hope its UI keeps people honest.
References
- https://roadmap.sh/cyber-security
- https://roadmap.sh/api-security-best-practices
- https://roadmap.sh/code-review-best-practices
- https://vercel.com/docs/deployments/overview
- https://cloudflare.com/learning/security/what-is-zero-trust/
---
Take the next step
If this is a problem in your product right now, here is what to do next:
- [Use the free Cyprian tools](/tools) - estimate cost, score app risk, check launch readiness, or pick the right service sprint.
- [Book a discovery call](/contact) - I will tell you honestly whether you need a sprint or if you can DIY the next step.
*Written by Cyprian Tinashe Aarons - senior full-stack and AI engineer helping founders rescue, launch, automate, and scale AI-built products.*
Cyprian Tinashe Aarons — Senior Full Stack & AI Engineer
Cyprian helps founders rescue, secure, deploy, and automate AI-built apps with production-grade engineering, launch systems, and AI integration.