-
-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update pgsodium extension scripts (#1397)
* fix: pgsodium after-create script * chore: bump version
- Loading branch information
Showing
3 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
ansible/files/postgresql_extension_custom_scripts/pgsodium/after-create.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,26 @@ | ||
grant execute on function pgsodium.crypto_aead_det_decrypt(bytea, bytea, uuid, bytea) to service_role; | ||
grant execute on function pgsodium.crypto_aead_det_encrypt(bytea, bytea, uuid, bytea) to service_role; | ||
grant execute on function pgsodium.crypto_aead_det_keygen to service_role; | ||
|
||
CREATE OR REPLACE FUNCTION pgsodium.mask_role(masked_role regrole, source_name text, view_name text) | ||
RETURNS void | ||
LANGUAGE plpgsql | ||
SECURITY DEFINER | ||
SET search_path TO '' | ||
AS $function$ | ||
BEGIN | ||
EXECUTE format( | ||
'GRANT SELECT ON pgsodium.key TO %s', | ||
masked_role); | ||
|
||
EXECUTE format( | ||
'GRANT pgsodium_keyiduser, pgsodium_keyholder TO %s', | ||
masked_role); | ||
|
||
EXECUTE format( | ||
'GRANT ALL ON %I TO %s', | ||
view_name, | ||
masked_role); | ||
RETURN; | ||
END | ||
$function$; |
9 changes: 9 additions & 0 deletions
9
ansible/files/postgresql_extension_custom_scripts/pgsodium/before-create.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
do $$ | ||
declare | ||
_extversion text := @extversion@; | ||
_r record; | ||
begin | ||
if _extversion is not null and _extversion != '3.1.8' then | ||
raise exception 'only pgsodium 3.1.8 is supported'; | ||
end if; | ||
end $$; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters