Pluxra
6 exposed tables locked downClearwater Bio · Clinical lab scheduling (~50 people)· Delivered in 2 weeks

Locking down Clearwater Bio's AI-built intake portal before launch

Audited and re-engineered an AI-generated Supabase/React prototype—closing 6 open database tables, removing leaked server keys, and passing clinic security review.

Postgres RLSServer API ProxyZod ValidationStrict CSP
Tables with permissive RLS (USING true)
0 tables
Baseline: 6 tables
Client-bundled server credentials
0 keys in client
Baseline: 2 keys exposed
External clinic security audit
Approved in 14 days
Baseline: Blocked launch

Context

Clearwater Bio used an AI app generator to prototype a self-service specimen intake portal for partner clinics. While the user interface worked smoothly in demos, an internal pre-launch check flagged severe database exposure patterns similar to the 2025 Lovable/Supabase CVE-2025-48757 findings.

Risks identified

  • Six Postgres tables had Row Level Security left disabled or paired with USING (true) policies, making intake metadata readable by any anonymous caller querying the public REST endpoint.
  • Two privileged API keys intended for server webhooks had been pasted into client environment variables (VITE_*) and compiled straight into the public JS bundle.
  • Public appointment submission routes lacked rate limiting and server-side validation rules.

Engineering changes

We audited every table and replaced open policies with strict tenant-scoped Postgres RLS rules tied to authenticated claims (clinic_id), rotated all credentials, moved privileged integration calls behind server-side endpoints with Zod validation and per-IP throttling, and added strict Content-Security-Policy and HSTS headers.

Outcome

All six exposed tables were locked down, zero secret material remained in client assets, and Clearwater Bio cleared their partner clinic security review within two weeks.

Replacing permissive AI-generated RLS with strict tenant isolationsql
-- Before (insecure default generated during prototyping):
-- CREATE POLICY "allow_read" ON lab_intakes FOR SELECT USING (true);

ALTER TABLE public.lab_intakes ENABLE ROW LEVEL SECURITY;

CREATE POLICY "tenant_read_own_intakes"
  ON public.lab_intakes
  FOR SELECT
  TO authenticated
  USING (clinic_id = (auth.jwt() ->> 'clinic_id')::uuid);

Facing a similar performance, SEO, or security bottleneck?

Run a diagnostic scan on your public domain or send your architecture details directly to our engineers.