Skip to content
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

feat: support non-superuser event trigger #98

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

steve-chavez
Copy link
Member

@steve-chavez steve-chavez commented Dec 5, 2024

Closes #67.

The privileged_role is able to switch to superuser to create event triggers.

To prevent privesc, superusers and reserved_roles skip event trigger execution.

Limitation: while doing create extension event triggers will not be fired, since extensions are created by a superuser.

Implementation

It uses the fmgr_hook to skip event triggers. However note that fmgr_hook doesn't really offer a direct way to say "skip this function execution" (although we can abort with ereport), so to achieve this the workaround is to override the FmgrInfo and turn into a noop.

The `privileged_role` is able to switch to superuser to create event
triggers.

To prevent privesc, superusers and `reserved_roles` skip event trigger
execution.

Limitation: create extension will not fire event triggers, since
extensions are created by superuser.
@steve-chavez steve-chavez marked this pull request as ready for review January 22, 2025 08:23
@steve-chavez steve-chavez requested a review from soedirgo January 22, 2025 08:24
@steve-chavez
Copy link
Member Author

The constrained extensions feat is failing bc of some change in CI resources, it doesn't fail locally. So its unrelated to this PR. Just commenting those tests for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow using event triggers without SUPERUSER
1 participant