vibhorkum / pg_background

pg_background
GNU General Public License v3.0
147 stars 36 forks source link

Permission errors after latest changes #5

Closed Chillybeans closed 6 years ago

Chillybeans commented 6 years ago

Transactions that use the public permissions to execute the functions are giving permission denied errors. The public group does not have execute permission on the functions since the latest commit.

Most other extensions have no problems with keeping the default x permission for the public group. This currently breaks a few components. Is it possible to revert the changes to the permissions and not specifically revoke them?

vibhorkum commented 6 years ago

This is intentional. Due to security reason, we removed the access from public.

You can manually grant the execute access to database users, as given below: GRANT EXECUTE ON pg_background_launch(TEXT) TO username; etc..

gous32 commented 6 years ago

When I'm trying to execute pg_background_result via not superuser, an error "permission denied for background worker with PID ...". After debugging we realiset that inside C function pg_background_result field info->current_user_id is always 0.

Adding line info->current_user_id = current_user_id; in 720 line solves this problem.

vibhorkum commented 6 years ago

Thank you for reporting. Fixed

edb=> SELECT pg_background_launch('SELECT 1');
 pg_background_launch 
----------------------
                 3339
(1 row)

edb=> SELECT * FROM pg_background_result(3339) as (result INTEGER);
 result 
--------
      1
(1 row)
vibhorkum commented 6 years ago

Reported issue is fixed. Commit #: https://github.com/vibhorkum/pg_background/commit/434c0a8eadb8998c970b417ede47fbe641a84d77