-
Notifications
You must be signed in to change notification settings - Fork 94
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
[OSS-ONLY] Restrict grant to/from any babelfish created role via PG port #3386
base: BABEL_5_0_STABLE
Are you sure you want to change the base?
[OSS-ONLY] Restrict grant to/from any babelfish created role via PG port #3386
Conversation
if (OidIsValid(roleid) && IS_DEFAULT_BBF_SERVER_ROLE(rolename)) | ||
if (OidIsValid(roleid) && is_babelfish_role(rolename)) | ||
{ | ||
pfree(rolename); |
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.
We didn't palloc'd this object so shouldn't be free'ing it as well.
@@ -973,7 +975,8 @@ is_babelfish_role(const char *role) | |||
&& OidIsValid(bbf_msdb_guest_oid) | |||
&& is_member_of_role(role_oid, bbf_master_guest_oid) | |||
&& is_member_of_role(role_oid, bbf_tempdb_guest_oid) | |||
&& is_member_of_role(role_oid, bbf_msdb_guest_oid)) | |||
&& is_member_of_role(role_oid, bbf_msdb_guest_oid) | |||
&& is_member_of_role(bbf_admin_oid, role_oid)) |
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.
What about only checking membership against bbf_role_admin? Is it sufficient or do we still need the above checks?
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.
Tried, that wasn't sufficient for a case where a TSQL user having sysadmin privilege was able to create/alter a user via PG port. Since TSQL user created the PG user, it was being considered as a BBF user and didn't get dropped.
Pull Request Test Coverage Report for Build 12685975063Details
💛 - Coveralls |
Description
Restrict grant to/from any babelfish created role via PG port
All server and database roles including fixed server roles and database roles have 'bbf_role_admin' as its member. Added a check to identify if 'bbf_role_admin' is a member of any role in addition to the existing checks to avoid granting any Babelfish db/server role to another Babelfish db/server roles including fixed db and server roles.
Issues Resolved
Task: BABEL-5505
Signed-off-by: Shalini Lohia lshalini@amazon.com
Test Scenarios Covered