Skip to content

feat: add test for security definer functions #1461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions nix/tests/expected/security.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
-- get a list of security definer functions owned by supabase_admin
-- this list should be vetted to ensure the functions are safe to use as security definer
select
p.proname
from pg_catalog.pg_proc p
left join pg_catalog.pg_namespace n ON n.oid = p.pronamespace
where p.proowner = (select oid from pg_catalog.pg_roles where rolname = 'supabase_admin')
and p.prosecdef = true
order by 1;
proname
--------------------------------
dblink_connect_u
dblink_connect_u
disable_security_label_trigger
enable_security_label_trigger
get_key_by_id
get_key_by_name
get_named_keys
get_schema_version
increment_schema_version
mask_role
pgaudit_ddl_command_end
pgaudit_sql_drop
repack_trigger
st_estimatedextent
st_estimatedextent
st_estimatedextent
update_mask
(17 rows)

9 changes: 9 additions & 0 deletions nix/tests/sql/security.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- get a list of security definer functions owned by supabase_admin
-- this list should be vetted to ensure the functions are safe to use as security definer
select
p.proname
from pg_catalog.pg_proc p
left join pg_catalog.pg_namespace n ON n.oid = p.pronamespace
where p.proowner = (select oid from pg_catalog.pg_roles where rolname = 'supabase_admin')
and p.prosecdef = true
order by 1;
Loading