-
Notifications
You must be signed in to change notification settings - Fork 455
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
Pre create anon ext #6272
Merged
Merged
Pre create anon ext #6272
Conversation
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
lubennikovaav
requested review from
ololobus,
knizhnik and
vadim2404
and removed request for
a team
January 4, 2024 12:40
lubennikovaav
force-pushed
the
pre_create_anon_ext
branch
from
January 4, 2024 12:41
97776cf
to
8c01c79
Compare
2394 tests run: 2278 passed, 0 failed, 116 skipped (full report)Flaky tests (3)Postgres 15
Postgres 14Code coverage (full report)
The comment gets automatically updated with the latest test results
d97db42 at 2024-02-08T11:18:13.381Z :recycle: |
vadim2404
reviewed
Jan 4, 2024
Should we first merge neondatabase/postgres#339 (na similar PRs for other Postgres versions) before enabling |
lubennikovaav
force-pushed
the
pre_create_anon_ext
branch
from
January 5, 2024 16:23
8c01c79
to
ddbbac5
Compare
lubennikovaav
force-pushed
the
pre_create_anon_ext
branch
from
January 10, 2024 22:58
28ad62e
to
af0f11b
Compare
lubennikovaav
force-pushed
the
pre_create_anon_ext
branch
from
January 24, 2024 14:45
6a2cde4
to
5708a1a
Compare
vadim2404
reviewed
Jan 24, 2024
vadim2404
reviewed
Jan 24, 2024
vadim2404
reviewed
Feb 1, 2024
vadim2404
approved these changes
Feb 7, 2024
if anon is in shared_preload_libraries. Users cannot install it themselves, because superuser is required. GRANT all priveleged needed to use it to db_owner We use the neon fork of the extension, because small change to sql file is needed to allow db_owner to use it. This feature is behind a feature flag AnonExtension, so it is not enabled by default.
lubennikovaav
force-pushed
the
pre_create_anon_ext
branch
from
February 7, 2024 20:49
ba2de7e
to
d97db42
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
It is not possible to create anon extension, because it requires superuser to install the extension:
From extension docs:
https://gitlab.com/dalibo/postgresql_anonymizer/-/blob/master/anon.sql#L30
Summary of changes
Add anon extension to compute image.
If anon is in
shared_preload_libraries
and feature flaganon_extension
is set in control-plane,pre-create extension from superuser at compute start. Run
anon.init()
and adjust grants to allowdb_owner
to use the extension.Some functions in anon.sql that access these GUCs are SECURITY DEFINER (called with owner privileges).
So, I change their ownership to db_owner. As well as ownership of other objects in the schema.
Since we don't have any good concept of superuser yet, I decided that
db_owner
is a good candidate for "superuser-like" role in the context of anon extension.db_owner
to start and stop dynamic masking, I had to patch anon extensionThis PR uses neon fork of postgresql_anonymizer
I've tested it in preview with commands from this script.
https://gist.github.com/lubennikovaav/33e3fe1acafed9be452fc32261683dad