How can I revoke execution of a PostgreSQL function? #17606
steve-chavez
announced in
Troubleshooting
Replies: 1 comment
-
Please note that the role/users like We noticed that for any new function that we made, postgres would automatically give execute privileges to the following roles:
You can verify this behavior by looking up permissions for your function (source: SO answer): SELECT f.proname AS name,
f.proargtypes AS signature,
f.proacl AS permissions
FROM pg_catalog.pg_proc AS f
JOIN pg_catalog.pg_namespace AS s
ON f.pronamespace = s.oid
WHERE f.proname = 'myfunction'
AND s.nspname = 'myschema'; To limit permissions correctly we had to revoke privileges from multiple users, not just
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
All functions access is PUBLIC by default, this means that any role can execute it. To revoke execution, there are 2 steps required:
foo
in this case) from PUBLIC:anon
in this case):Now
anon
should get an error when trying to execute the function:Beta Was this translation helpful? Give feedback.
All reactions