-
Notifications
You must be signed in to change notification settings - Fork 93
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
Execute CREATE/GRANT ROLE statements using bbf_role_admin during restore #3082
base: BABEL_4_X_DEV
Are you sure you want to change the base?
Execute CREATE/GRANT ROLE statements using bbf_role_admin during restore #3082
Conversation
Signed-off-by: Rishabh Tanwar <ritanwar@amazon.com>
Signed-off-by: Rishabh Tanwar <ritanwar@amazon.com>
Signed-off-by: Rishabh Tanwar <ritanwar@amazon.com>
Pull Request Test Coverage Report for Build 11890286888Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Signed-off-by: Rishabh Tanwar <ritanwar@amazon.com>
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.
Let's run these tests in the upgrade workflows.
Signed-off-by: Rishabh Tanwar <ritanwar@amazon.com>
Signed-off-by: Rishabh Tanwar <ritanwar@amazon.com>
Signed-off-by: Rishabh Tanwar <ritanwar@amazon.com>
Signed-off-by: Rishabh Tanwar <ritanwar@amazon.com>
/* | ||
* First execute REVOKE statement using bootstrap user. | ||
* This is needed since grantor of GRANTs from previous versions might | ||
* not be bbf_role_admin. | ||
*/ | ||
SetUserIdAndSecContext(BOOTSTRAP_SUPERUSERID, save_sec_context | SECURITY_LOCAL_USERID_CHANGE); | ||
PG_TRY(); | ||
{ | ||
call_prev_ProcessUtility(pstmt, queryString, readOnlyTree, context, params, | ||
queryEnv, dest, qc); | ||
} | ||
PG_FINALLY(); | ||
{ | ||
/* Clean up. Restore previous state. */ | ||
SetUserIdAndSecContext(save_userid, save_sec_context); | ||
} | ||
PG_END_TRY(); |
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.
Can we identify those faulty GRANT and correct those in upgrade?
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.
Or Is it possible to escalate to BOOTSTRAP_SUPERUSERID in some of the cases only? Are there any alternatives apart from we escalate to BOOTSTRAP_SUPERUSERID -- using somewhat less-privileged user?
if (isadmin) | ||
break; |
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.
Please explain this.
if (isadmin) | ||
break; | ||
|
||
/* Save the previous user to be restored after creating the login. */ |
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.
after creating the login?
Description
Execute CREATE/GRANT ROLE statements using bbf_role_admin during restore
so that bbf_role_admin becomes the admin/GRANTOR. We will do this only if the
current is superuser since only superuser is allowed to perform dump/restore.
Note that no additional permission checks are needed as superusers can anyway
perform this action.
Additionally, even revoke grants GRANTED by BOOTSTRAP_SUPERUSER since grantor
of GRANTs from previous versions might be bbf_role_admin.
Task: BABEL-5309
Signed-off-by: Rishabh Tanwar ritanwar@amazon.com
Test Scenarios Covered
Use case based -
Boundary conditions -
Arbitrary inputs -
Negative test cases -
Minor version upgrade tests -
Major version upgrade tests -
Performance tests -
Tooling impact -
Client tests -
Check List
By submitting this pull request, I confirm that my contribution is under the terms of the Apache 2.0 and PostgreSQL licenses, and grant any person obtaining a copy of the contribution permission to relicense all or a portion of my contribution to the PostgreSQL License solely to contribute all or a portion of my contribution to the PostgreSQL open source project.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.