@davoodmehraban89 / LifeMate / commits / 5a3b1ff
Fork 0

LifeMate — Personal, Family & Learning Companion

docs(audit): record real zero-cost Supabase QA setup and RLS-denied probe

davoodmehraban89 committed Oct 15, 2026 at 00:34 UTC 5a3b1ff1473ec0cfe5662c8c19de6740c424eb28
1 file changed +81
docs/audits/2026-10-15-supabase-qa-provisioning.md new
+81
@@ -0,0 +1,81 @@
1 +# Supabase LifeGuide-QA provisioning and private probe — 2026-10-15
2 +
3 +Status: **QA database provisioned; integration not deployed**. Evidence here comes from actual connected Supabase tool responses, not from a user/device test.
4 +
5 +## Scope, authorization and cost
6 +
7 +Owner chose a general-purpose Supabase organization **DM Studio**, with each software product as a separate project. Organization list after reconnect confirms:
8 +- Organization `DM Studio`, ID `unrlckipyubhegrpqgei`, plan `free`.
9 +- Existing project `Finora ERP – Production`, ID `hcsixhqbyuhpshfwqpjx`, reported `ACTIVE_HEALTHY`. No writes or changes to it.
10 +- `get_cost(type=project, organization_id=unrlckipyubhegrpqgei)` returned `{"type":"project","recurrence":"monthly","amount":0}`. Zero-cost confirmation obtained in the connector; no card/purchase/upgrade was submitted. Free-tier project limit and pauses remain provider constraints. The provider successfully admitted the project.
11 +
12 +Actual new project:
13 +- Name: **LifeGuide-QA**
14 +- Supabase project ID: `iqkrwxeprxvdiubdfcrb`
15 +- Organization ID: `unrlckipyubhegrpqgei`
16 +- Region: `eu-central-1` (Frankfurt)
17 +- Status after provision: **ACTIVE_HEALTHY**
18 +- PostgreSQL: **17.11**
19 +- Project API base: `https://iqkrwxeprxvdiubdfcrb.supabase.co`. This is **NOT** the old LifeGuide Express REST API or the PWA address; Flutter must **not** be switched to this URL.
20 +
21 +## Actual QA write and security verification
22 +
23 +At first inspection:
24 +- `public` application tables: **0**.
25 +- Supabase migration list: empty; Edge Functions list: empty.
26 +- PostgreSQL `pgcrypto` already installed in `extensions`.
27 +- Initial Supabase security/performance advisors: no findings.
28 +
29 +Applied **one additive migration** through the Supabase migration tool: `20261014210221_lifeguide_qa_isolated_connectivity_baseline`.
30 +Source mirror: `supabase/migrations/20261014210221_lifeguide_qa_isolated_connectivity_baseline.sql`.
31 +
32 +This migration created only:
33 +- private schema `lifeguide_qa`
34 +- table `lifeguide_qa.setup_probe`, containing a UUID, **synthetic-only** probe name, timestamp
35 +- RLS enabled and forced; explicit **no `anon` or `authenticated` schema/table grants**, and no RLS policies (deliberately deny all).
36 +- No public tables, no credentials, no parent/child identities, and no production content.
37 +
38 +Database write performed:
39 +```sql
40 +insert into lifeguide_qa.setup_probe(probe_name)
41 +values ('synthetic_backend_handshake')
42 +on conflict (probe_name) do update set probe_name=excluded.probe_name
43 +returning probe_name, created_at;
44 +```
45 +This returned exactly one synthetic record. A separate read-only SQL verification returned:
46 +
47 +| Check | Observed |
48 +| --- | --- |
49 +| synthetic_receipts | 1 |
50 +| public_app_tables | 0 |
51 +| qa_tables | 1 |
52 +| anon_schema_usage | false |
53 +| authenticated_schema_usage | false |
54 +| anon_table_select | false |
55 +| authenticated_table_select | false |
56 +| rls_enabled | true |
57 +| rls_forced | true |
58 +
59 +Post-migration security advisor: one **INFO** `rls_enabled_no_policy` finding for `lifeguide_qa.setup_probe`; this is **expected by design** because the private setup table has no policies and client access is intentionally denied. This is not a permission leak. If this table is ever repurposed as an application table, explicit restrictive policies and negative authorization tests become mandatory.
60 +
61 +Remediation reference: https://supabase.com/docs/guides/database/database-linter?lint=0008_rls_enabled_no_policy
62 +
63 +## Compatibility conclusion and remaining gates
64 +
65 +Existing LifeGuide v0.7.1:
66 +- Backend is **Node >=22 / Express 5**, with native `argon2`, `pg`, bespoke JWT/session auth, rate limiting and backup/role scripts.
67 +- Original 20 PostgreSQL migrations are intended for a self-hosted PostgreSQL 16 instance with distinct bootstrap, API, migrator and backup roles; provisioner expects schema ownership/role topology that must not be applied without adapting to Supabase Postgres 17 managed role model.
68 +- Supabase PostgreSQL gives the right SQL family and `pgcrypto`, **but Supabase itself does not run the existing long-lived Express server**. Need an approved adapter strategy: independent Express host, or a scoped Edge Functions implementation with consent and permission parity. Calling the Supabase project URL the existing `/api` would be incorrect.
69 +- There is **no** PWA/Android application integration, no `LifeGuide` application data schema, no 20 app migrations, no Auth/API adapter, no Edge Function and no public app deployment.
70 +- Must confirm internet reachability and permitted usage from inside Iran without VPN. Free project inactivity pause, quotas and synthetic-data export/backup remain open.
71 +- Required vertical slice: child task save/close/reopen → authorized mother/father report → unauthorized reader denied → correct duration in seconds → offline resend without duplicate.
72 +- Existing `docs/decisions/0009-provider-neutral-hosting.md` remains production baseline. This isolated QA experiment **does not authorize** changing DNS, live deployments, real-data import, production DB roles, app signing or merging main/PR #10–13.
73 +
74 +## Next implementation milestone
75 +
76 +1. Prepare an explicit **backend+auth compatibility matrix** from source and managed DB role capabilities.
77 +2. Choose one secure, reversible API strategy, keeping existing family-authorizations intact.
78 +3. Only then apply reviewed **synthetic-only** application migrations and build an authenticated API vertical slice.
79 +4. Validate real Android + PWA devices and no-VPN reachability independently. Do not report these as complete beforehand.
80 +
81 +Owner action currently needed: **none** for the already provisioned QA database; no payment card needed.