Skip to content

Commit a26236c

Browse files
committed
feat: add test for security definer functions
1 parent 6aa8c5d commit a26236c

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

nix/tests/expected/security.out

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
-- get a list of security definer functions owned by supabase_admin
2+
-- this list should be vetted to ensure the functions are safe to use as security definer
3+
select
4+
p.proname
5+
from pg_catalog.pg_proc p
6+
left join pg_catalog.pg_namespace n ON n.oid = p.pronamespace
7+
where p.proowner = (select oid from pg_catalog.pg_roles where rolname = 'supabase_admin')
8+
and p.prosecdef = true
9+
order by 1;
10+
proname
11+
--------------------------------
12+
dblink_connect_u
13+
dblink_connect_u
14+
disable_security_label_trigger
15+
enable_security_label_trigger
16+
get_key_by_id
17+
get_key_by_name
18+
get_named_keys
19+
get_schema_version
20+
increment_schema_version
21+
mask_role
22+
pgaudit_ddl_command_end
23+
pgaudit_sql_drop
24+
repack_trigger
25+
st_estimatedextent
26+
st_estimatedextent
27+
st_estimatedextent
28+
update_mask
29+
(17 rows)
30+

nix/tests/sql/security.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- get a list of security definer functions owned by supabase_admin
2+
-- this list should be vetted to ensure the functions are safe to use as security definer
3+
select
4+
p.proname
5+
from pg_catalog.pg_proc p
6+
left join pg_catalog.pg_namespace n ON n.oid = p.pronamespace
7+
where p.proowner = (select oid from pg_catalog.pg_roles where rolname = 'supabase_admin')
8+
and p.prosecdef = true
9+
order by 1;

0 commit comments

Comments
 (0)