feat(supabase): SQL gate reports non-http(s) reference urls (reference.url.scheme), pgTAP 008 cases; EVAL-010, journal, TODO 4c

This commit is contained in:
bchanot committed 2026-10-10 10:10:45 +02:00
1 parent 34be7e23df
commit c0c17fcf5f
6 files changed
+32 -3

No files matched your search

@@ -1,7 +1,7 @@
-- Document schema_version 2: references registry, review status, count
-- ranges. Only version 2 is stored; the SQL gate re-checks the new rules.
begin;
select plan(8);
select plan(10);
insert into auth.users (id, email) values ('50000000-0000-0000-0000-00000000000a', 'alice-v2@test.local');
@@ -73,6 +73,14 @@ select is(
private.sheet_document_issues(jsonb_set(pg_temp.doc('[]', '[]', 'null'), '{references}', '"x"')),
'{document.shape}'::text[], 'a non-array references registry is a shape error'
);
select is(
private.sheet_document_issues(pg_temp.doc('[{"id":"bad","type":"web","citation":"x","url":"javascript:alert(1)","doi":null}]', '[]', 'null')),
'{reference.url.scheme}'::text[], 'a reference url outside http(s) is reported'
);
select is(
private.sheet_document_issues(pg_temp.doc('[{"id":"ok","type":"web","citation":"x","url":"https://example.org/a","doi":null}]', '[]', 'null')),
'{}'::text[], 'an https reference url passes'
);
-- Only schema_version 2 rows are stored.
set local role authenticated;