אבטחה ופרטיות
מובייל: הצטרפות ובקשת מחיקה
תיעוד הצטרפות, מסירת בקשת מחיקה וגבולות מחזור חיי החשבון.
בעמוד הזה
Approved change scope#
- Reuse the existing personal Clerk identity for every plan; never require an organization to sign in.
- Personal / Family: authenticated Clerk user + an individual/family Supabase tenant; no Clerk Organization.
- Business / Enterprise: the same personal Clerk user + a business Supabase tenant and a dedicated Clerk Organization. Organization is created by that user, tagged with immutable tenant ID in Clerk private metadata, and persisted in the already-existing
ev1_tenants.clerk_org_idcolumn using server-side service credentials after verification. - Reuse the existing
lne_create_accountRPC with per-plan UUID idempotency. Only the authenticated user can provision for their identity. Never accept a client-supplied owner or org ID. - Enterprise Organization memberships are not arbitrarily capped by the existing five-person default; actual Supabase tenant role permissions and commercial entitlements remain independent.
- Existing UI screens, layout, assets, colors, fonts, navigation and payments are locked. Two narrowly scoped account-action cards are added after the approved Account screen content, using existing
AppScreentokens. The obsolete empty-state copy is corrected without rearranging content.
Technical flow#
- User signs into Clerk via existing native sign-up/login; account creation / verification and token cache are unchanged.
- In Account screen, select Personal / Family / Business / Enterprise, supply valid name and optional organization tax/legal fields, consent to the existing terms/privacy, and submit.
- Mobile sends
POST /api/client/v1/accountswith Bearer session and a persisted request UUID. No service-role key or payment key ever goes into the mobile bundle. - API verifies Clerk session via
clientIdentity(), uses existing user JWT-backed Supabase client and RLS, invokeslne_create_accountand re-reads the tenant for exact owner+plan. - For Business / Enterprise, backend creates or recovers an org from Clerk private metadata and owner ID, and then server-links it to the tenant via the pre-existing
clerk_org_idcolumn. Existing registered orgs never get overwritten or silently re-associated. - On success,
WorkspaceProvider.refresh(preferredTenantId)checks the new ID exists in authorizedcontext.tenantsand selects it. No client-chosen tenant role is trusted.
Concurrency/recovery: Clerk Production intentionally has Organization slugs disabled; the implementation does not change that setting or require a slug. The unique, service-only lne_clerk_org_provision_claims(tenant_id) row is reserved before the first external create attempt. Only an exact owner/tenant match in Clerk private metadata is eligible for recovery. If a creation is uncertain and cannot be verified, the claim remains locked and the user receives a safe pending/review response — never a blind second organization. Concurrency and signed-device QA are still explicit release gates.
In-app account deletion request#
- User can select
בקשה למחיקת החשבוןfrom Account screen, read the warning and confirm explicitly. - API
POST /api/client/v1/account/deletiononly accepts authenticated Clerk Bearer tokens and a strictDELETE_MY_ACCOUNTconfirmation.GETon the same path returns only the authenticated user's pending request status for subsequent app launches. - DB queue
lne_account_deletion_requestshas RLS enabled, noanonorauthenticateddirect privileges or policies, and one pending request per Clerk user. Its data is read/written by service-role backend only. Repeated requests return the same pending record, not duplicates. - This action does not immediately erase or suspend the identity, because ownership of organizations and financial/legal retention must be resolved first.
- A verified operator must: confirm user ownership and identity; list all memberships/owned tenants and other organization admins; transfer ownership or obtain closure consent; stop relevant future subscriptions; export and preserve only legally required billing records; erase/scrub non-required user and device data across Supabase, Clerk and processors; revoke tokens/delete Clerk user; mark request completed; notify the verified contact address. Financial accounting/audit data must not be silently destroyed. This operator workflow has NOT been automated or executed.
- Apple permits manual erasure processing if users receive a clear expectation and confirmation. Before public App Review, the organization must define and actually staff a time-bound SLA, complete end-to-end test and notification delivery. Storing a request is not equivalent to completing account deletion.
External deletion request — Google Play#
- Public route:
https://linknodesenergy.com/account-deletion(company website only), built using existingCompanyShelland style system. Links directly to the existing secure company contact form, where users can submit a deletion request without reinstalling or logging into the app. Contact form processing and delivery must be tested with an authorized synthetic request, and privacy retention policy must be reviewed. - Do not force app reinstall or require another user's workspace. Link the direct deletion URL in Google Play Data Safety / account deletion fields, after verifying Production route HTTP 200 and form delivery.
- Public terms/privacy URLs remain unchanged.
QA acceptance matrix (not all verified)#
| Case | Intended result | Gate |
|---|---|---|
| Personal | Own individual tenant, no Clerk Organization | Signed-device/real Supabase test pending |
| Family | Own personal-kind family tenant, no Clerk Organization | Signed-device test pending |
| Business | Individual Clerk user + business tenant + Clerk org bound by private metadata | Real sandbox service test pending |
| Enterprise | Individual Clerk user + enterprise tenant + dedicated org; seats/role verification | Real multi-member test pending |
| Existing personal workspace | Do not create a second personal-kind tenant | RLS and idempotency tests pending |
| Concurrent requests | One Supabase tenant / no duplicate Clerk org | Chaos test pending |
| Tenant crossover | Wrong-user/wrong-tenant organization cannot be linked | Unit policy tests, live negative tests pending |
| Deletion request | Authenticated confirm; repeat request idempotent; no unsafe deletion | DB privilege/read-only checks and API tests pending |
| Legal retention | Keep required financial documents, remove all unnecessary personal data | Compliance decision + operator implementation pending |
| External web request | Works without app; lands in operator queue | Live contact form QA pending |
No deployment without gates#
- Additive SQL migrations are recorded in Supabase as
20261111155528_mobile_onboarding_and_deletion_requestsand20261111161830_clerk_org_provision_claims. Both queue tables have RLS ON and zero anon/authenticated policies; service role only. Check this again before a public launch. - Staging/mobile TypeScript, Next.js production preview, and tests must pass.
- No real customer deletion or organization creation during development/QA without specific authorization and disposable test identities.
- Clerk Organizations are enabled with personal membership optional; do not change that to membership required.
- Corporate publisher ownership, Apple/Google signing and digital-subscription payment policy remain separate P8 store gates.
Rollback#
- If QA fails or any unauthorized visual change occurs, revert the isolated PR and restore the last approved main commit. Do not edit approved app layout/assets; do not delete persisted customer accounts or migration records merely to roll back UI code.