Create polished demo videos without editing skills. Mac/Windows/Linux
Verify hardened feedback access against current main
webadderall772bd64de85a
diff --cc services/supabase/README.mdindex 40d425ce,6a9ba910..d9a88ba4--- a/services/supabase/README.md+++ b/services/supabase/README.md@@@ -16,8 -16,12 +16,18 @@@ A local demo account can preview the foUnit tests exercise the server handler with an injected storage/auth backend. `tests/feedback_limits.sql` verifies the migration's quotas and permissions in a disposable database with the migrations applied; it rolls back its test data. Live deployment and end-to-end Supabase uploads must be checked separately before release.+## Access verification+- Run `checks/feedback-quota-access.sql` as postgres after all feedback migrations in a disposable Supabase database. It uses an existing user with no feedback usage today and rolls back test data. It checks server-only quota access, authenticated attachment-upload denial for the feedback bucket, client report write denial, anonymous read denial, and all three daily limits. The older `checks/feedback-access.sql` is only for testing migration 001 in isolation, before migration 002 removes direct client inserts.++Run `checks/feedback-quota-access.sql` as postgres after all feedback migrations in a disposable Supabase database. It uses an existing user with no feedback usage today and rolls back test data. It checks server insertion, owner reads and cross-user isolation after hardening, server-only quota access, authenticated attachment-upload denial for the feedback bucket, client report write denial, anonymous read denial, and all three daily limits. The older `checks/feedback-access.sql` is only for testing migration 001 in isolation, before migration 002 removes direct client inserts.++Do not put real account IDs, project references, credentials, or operator setup status in this documentation.+++ ## User-triggered export error reports (no account link)++ Apply `202610020001_export_error_reports.sql` and deploy `submit-export-error` using `services/supabase/config.toml` (`verify_jwt = false`). The new function is public and accepts only the validated, 4 KiB technical-report schema; clients cannot insert/read reports directly. No change to manual account-linked feedback is required. Configure the existing public URL/publishable key in the desktop build. Never expose a service-role key.++ The export error dialog has **Report error**, then a preview and explicit **Send report** action. Nothing is sent automatically or on opening the preview. The optional cloud-plan category is self-reported (`paid`, `not_paid`, or `unknown`); it is not an authenticated billing check. Current main does not expose a billing entitlement to this UI. The client uses `fetch` with no session Authorization, cookies or referrer. Reports store no account ID/email, media, path, logs, persistent device ID or IP. The function rejects Authorization headers and unknown payload fields. Supabase/infrastructure connection logs can still contain request metadata/IP; do not describe this as guaranteed anonymity.++ View `public.export_error_reports` through staff/service-role access. Reports contain allowlisted error codes, numerical failure positions for both decoding attempts, format, stage, output dimensions/FPS, app version and OS, plus the optional cloud-plan category. Creation times are rounded to the hour. A database quota caps accepted anonymous submissions at 20 per minute globally without storing identity; this is an aggregate abuse/cost control, not per-user protection, and can be exhausted by other callers. No raw error text is persisted. Failed requests are retryable by the user.++ The migration enables Supabase Cron and schedules daily deletion of reports older than 30 days and aggregate quota counters older than one day. Confirm the job exists and succeeds before releasing the client. Apply and validate this migration/function separately; no live backend deployment is performed by the code change. Update your collection/privacy notice with the real Supabase hosting country, infrastructure logging, recipients and retention. Explicit click-to-send and minimisation reduce risk but do not establish legal compliance for every jurisdiction.diff --cc services/supabase/checks/feedback-quota-access.sqlindex 23910dc2,00000000..95242594mode 100644,000000..100644--- a/services/supabase/checks/feedback-quota-access.sql+++ b/services/supabase/checks/feedback-quota-access.sql@@@ -1,71 -1,0 +1,95 @@@+-- Run as postgres after migration 002. All quota changes are rolled back.+-- Uses an existing auth user with no usage today; no auth users are created.+begin;+do $$+declare account uuid;+begin+ select id into account from auth.users u where not exists (+ select 1 from public.feedback_daily_usage q where q.user_id=u.id and q.day=(now() at time zone 'UTC')::date+ ) limit 1;+ if account is null then raise exception 'Requires an existing user with no feedback usage today'; end if;+ perform set_config('recordly.quota_test_owner', account::text, true);+ if has_function_privilege('authenticated', 'public.reserve_feedback_quota(uuid,integer,bigint)', 'EXECUTE')+ or has_function_privilege('anon', 'public.reserve_feedback_quota(uuid,integer,bigint)', 'EXECUTE')+ or has_table_privilege('authenticated', 'public.feedback_daily_usage', 'UPDATE')+ or has_table_privilege('authenticated', 'public.feedback_reports', 'INSERT')+ or has_table_privilege('authenticated', 'public.feedback_reports', 'UPDATE')+ or has_table_privilege('authenticated', 'public.feedback_reports', 'DELETE')+ or has_table_privilege('anon', 'public.feedback_reports', 'SELECT') then+ raise exception 'Client can bypass server quotas';+ end if;+ if not has_function_privilege('service_role', 'public.reserve_feedback_quota(uuid,integer,bigint)', 'EXECUTE') then+ raise exception 'Server cannot reserve quota';+ end if;+ if public.reserve_feedback_quota(account,6,1) or public.reserve_feedback_quota(account,1,10485761)+ or public.reserve_feedback_quota(account,-1,0) then raise exception 'Submission bounds bypassed'; end if;+end $$;++-- Preserve the server insertion path and owner isolation after the access migration.++select set_config('recordly.quota_test_report', gen_random_uuid()::text, true);++set local role service_role;++insert into public.feedback_reports (id, user_id, title, subject, message)++values (current_setting('recordly.quota_test_report')::uuid, current_setting('recordly.quota_test_owner')::uuid,++ 'Server access check', 'other', 'Temporary test; transaction will roll back.');++reset role;++select set_config('request.jwt.claim.sub', current_setting('recordly.quota_test_owner'), true);++set local role authenticated;++do $$++begin++ if not exists (select 1 from public.feedback_reports where id=current_setting('recordly.quota_test_report')::uuid) then++ raise exception 'Owner cannot read feedback after access hardening';++ end if;++end $$;++select set_config('request.jwt.claim.sub', gen_random_uuid()::text, true);++do $$++begin++ if exists (select 1 from public.feedback_reports where id=current_setting('recordly.quota_test_report')::uuid) then++ raise exception 'Cross-user read allowed after access hardening';++ end if;++end $$;++reset role;+++-- Exercise this bucket under the client role, without rejecting unrelated bucket policies.+select set_config('request.jwt.claim.sub', current_setting('recordly.quota_test_owner'), true);+set local role authenticated;+do $$+begin+ begin+ insert into storage.objects (id, bucket_id, name)+ values (gen_random_uuid(), 'feedback-attachments', current_setting('recordly.quota_test_owner') || '/' || gen_random_uuid()::text || '/test.png');+ raise exception 'Client can upload feedback without reserving quota';+ exception when insufficient_privilege then null;+ end;+end $$;+reset role;+savepoint empty_usage;+do $$+declare account uuid := current_setting('recordly.quota_test_owner')::uuid;+begin+ for i in 1..5 loop+ if not public.reserve_feedback_quota(account,5,1) then raise exception 'Valid file quota rejected'; end if;+ end loop;+ if public.reserve_feedback_quota(account,1,1) then raise exception 'Daily file quota bypassed'; end if;+end $$;+rollback to savepoint empty_usage;+do $$+declare account uuid := current_setting('recordly.quota_test_owner')::uuid;+begin+ for i in 1..5 loop+ if not public.reserve_feedback_quota(account,1,10485760) then raise exception 'Valid byte quota rejected'; end if;+ end loop;+ if public.reserve_feedback_quota(account,1,1) then raise exception 'Daily byte quota bypassed'; end if;+end $$;+rollback to savepoint empty_usage;+do $$+declare account uuid := current_setting('recordly.quota_test_owner')::uuid;+begin+ for i in 1..10 loop+ if not public.reserve_feedback_quota(account,0,0) then raise exception 'Valid report quota rejected'; end if;+ end loop;+ if public.reserve_feedback_quota(account,0,0) then raise exception 'Daily report quota bypassed'; end if;+ if (select reports from public.feedback_daily_usage where user_id=account and day=(now() at time zone 'UTC')::date) <> 10 then+ raise exception 'Rejected request changed quota';+ end if;+end $$;+rollback;+select 'PASS: server-only quota access, upload bypass blocked, per-report bounds and all three daily limits; test data rolled back' as result;