Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
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;
grant execute on function pgsodium.crypto_aead_det_noncegen to service_role;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is granted to public, so no need for the grant

10 changes: 8 additions & 2 deletions ansible/tasks/internal/supautils.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,17 @@

- name: supautils - copy extension custom scripts
copy:
src: files/postgresql_extension_custom_scripts
src: files/postgresql_extension_custom_scripts/
dest: /etc/postgresql-custom/extension-custom-scripts
mode: 0664
become: yes

- name: supautils - chown extension custom scripts
file:
mode: 0775
owner: postgres
group: postgres
path: /etc/postgresql-custom/extension-custom-scripts
recurse: yes
become: yes

- name: supautils - include /etc/postgresql-custom/supautils.conf in postgresql.conf
Expand Down
2 changes: 1 addition & 1 deletion common.vars.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1 +1 @@
postgres-version = "15.1.0.17-rc1"
postgres-version = "15.1.0.17-rc2"
3 changes: 1 addition & 2 deletions ebssurrogate/files/unit-tests/unit-test-01.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
BEGIN;
SELECT plan(9);
SELECT plan(8);

-- Check installed extensions
SELECT extensions_are(
Expand All @@ -26,7 +26,6 @@ SELECT has_schema('public');
SELECT function_privs_are('pgsodium', 'crypto_aead_det_decrypt', array['bytea', 'bytea', 'uuid', 'bytea'], 'service_role', array['EXECUTE']);
SELECT function_privs_are('pgsodium', 'crypto_aead_det_encrypt', array['bytea', 'bytea', 'uuid', 'bytea'], 'service_role', array['EXECUTE']);
SELECT function_privs_are('pgsodium', 'crypto_aead_det_keygen', array[]::text[], 'service_role', array['EXECUTE']);
SELECT function_privs_are('pgsodium', 'crypto_aead_det_noncegen', array[]::text[], 'service_role', array['EXECUTE']);

SELECT * from finish();
ROLLBACK;
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ grant pgsodium_keyiduser to postgres with admin option;
grant pgsodium_keyholder to postgres with admin option;
grant pgsodium_keymaker to postgres with admin option;

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;
Comment on lines +9 to +11
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea why, but pgsodium/after-create.sql are not run during create extension pgsodium above, but it's run if I recreate the extension (tested on staging). This was the cause of the build failures.

I'll just add these since the grants are supposed to be idempotent.


-- create extension if not exists supabase_vault;

-- migrate:down
7 changes: 3 additions & 4 deletions migrations/tests/database/privs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ SELECT database_privs_are(
'postgres', 'postgres', ARRAY['CONNECT', 'TEMPORARY', 'CREATE']
);

-- SELECT function_privs_are('pgsodium', 'crypto_aead_det_decrypt', array['bytea', 'bytea', 'uuid', 'bytea'], 'service_role', array['EXECUTE']);
-- SELECT function_privs_are('pgsodium', 'crypto_aead_det_encrypt', array['bytea', 'bytea', 'uuid', 'bytea'], 'service_role', array['EXECUTE']);
-- SELECT function_privs_are('pgsodium', 'crypto_aead_det_keygen', array[]::text[], 'service_role', array['EXECUTE']);
-- SELECT function_privs_are('pgsodium', 'crypto_aead_det_noncegen', array[]::text[], 'service_role', array['EXECUTE']);
SELECT function_privs_are('pgsodium', 'crypto_aead_det_decrypt', array['bytea', 'bytea', 'uuid', 'bytea'], 'service_role', array['EXECUTE']);
SELECT function_privs_are('pgsodium', 'crypto_aead_det_encrypt', array['bytea', 'bytea', 'uuid', 'bytea'], 'service_role', array['EXECUTE']);
SELECT function_privs_are('pgsodium', 'crypto_aead_det_keygen', array[]::text[], 'service_role', array['EXECUTE']);
2 changes: 1 addition & 1 deletion migrations/tests/test.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CREATE EXTENSION IF NOT EXISTS pgtap;

BEGIN;

SELECT plan(10);
SELECT plan(13);

\ir fixtures.sql
\ir database/test.sql
Expand Down