-
Notifications
You must be signed in to change notification settings - Fork 6
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
Check if schema already exists before create extension [BF-2375] #49
base: main
Are you sure you want to change the base?
Conversation
d044e6e
to
f848a9d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are using aiven_extras schema everywhere in the extension code, it makes sense not to check for @extschema@ but for aiven_extras directly.
Things could also be unified the other way, using @extschema@ everywhere.
As for the privileges escalation, is this enough ? Not sure how, but we could end up in a situation where the schema is rightfully owned by the correct user, but some default privileges have been added.
I'm not sure what the implication of this is, but could we instead:
- remove the schema from the control file, that way it is not created by postgres for us
- explicitly create the aiven_extras schema in the extension itself. That way it will also be dropped when we drop the extension.
That way we are sure the schema is created afresh, and if it already exists we fail.
This may require a bit more work for the upgrade scripts, which currently are supposed to be idempotent.
|
f848a9d
to
3e21ac4
Compare
What I mean is that instead of doing a |
Yes. Maybe this time only fix the bug instead, and keep the existing schema creation as it is? |
This might be more complicated to make the upgrade idempotent. The creation script file (e.g., This means we may also need the schema to be created in an update script. |
3e21ac4
to
005a008
Compare
7f96c26
to
e09a20e
Compare
9042894
to
9a037a4
Compare
If the schema aiven_extras already exists and belongs to an unprivileged user before adding the extension, it’s possible to abuse it to run some queries in the context of the superuser. [BF-2375]
9a037a4
to
bb93ca9
Compare
BF-2375
Security bug - privilege escalation