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

roleccl: enable GRANT/REVOKE for roles without a license #45325

Merged
merged 2 commits into from Feb 25, 2020

Conversation

knz
Copy link
Contributor

@knz knz commented Feb 24, 2020

Fixes #45275.
This was discussed (and agreed upon) with @nstewart and @piyush-singh.

Release note (security update): Non-licensed users are now
able to add more principals to the special superuser role/group
admin. (Creation of additional roles is still a licensed feature.)

Release note (sql change): It is now possible to use GRANT and
REVOKE to add users to the admin role without a valid
license. This change aims to enable use of the admin UI and other
privileged features without a license.

@knz knz requested a review from jordanlewis February 24, 2020 16:07
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@knz
Copy link
Contributor Author

knz commented Feb 24, 2020

cc @mattcrdb

@knz
Copy link
Contributor Author

knz commented Feb 24, 2020

cc @taroface - this change will also be backported so the corresponding doc update will be multi-version.

Copy link
Contributor

@RichardJCai RichardJCai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @jordanlewis, @knz, @RichardJCai, and @rohany)


pkg/ccl/roleccl/role.go, line 85 at r1 (raw file):

		// non-licensed users to add/remove users from the admin role, so
		// they can grant administrative privileges to user accounts that
		// are not superusers like "root".

Nit: Are we concerned at all about users going from enterprise to non-enterprise? They would be able to grant existing roles in that case.

@knz
Copy link
Contributor Author

knz commented Feb 24, 2020

Nit: Are we concerned at all about users going from enterprise to non-enterprise? They would be able to grant existing roles in that case.

Good question. Asking @nstewart:

No enterprise customers are paying JUST for RBAC, this is not a risk IMO. Furthermore, if they were big enough to pay our license for roles, they would certainly want to be able to edit them

Copy link
Contributor

@RichardJCai RichardJCai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @jordanlewis, @knz, and @rohany)


pkg/ccl/roleccl/role.go, line 236 at r1 (raw file):

		if err := utilccl.CheckEnterpriseEnabled(
			p.ExecCfg().Settings, p.ExecCfg().ClusterID(), p.ExecCfg().Organization(), "REVOKE <role>",

Need to remove this check too.

Copy link
Contributor

@RichardJCai RichardJCai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @jordanlewis, @knz, and @rohany)


pkg/ccl/roleccl/role.go, line 236 at r1 (raw file):

Previously, RichardJCai (Richard Cai) wrote…

Need to remove this check too.

Also probably want to add tests to sql/logictest/testdata/logic_test/role

Copy link
Contributor Author

@knz knz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @jordanlewis, @knz, @RichardJCai, and @rohany)


pkg/ccl/roleccl/role.go, line 236 at r1 (raw file):

Previously, RichardJCai (Richard Cai) wrote…

Also probably want to add tests to sql/logictest/testdata/logic_test/role

Good catch!

The GRANT and REVOKE statements are already tested in that logic test file.

Unfortunately we do not have testing infrastructure for checking that licensed features are available to non-licensed users and vice-versa. As this PR will be backported, I am reluctant to add new infrastructure as it would make the backport more complicated to manage. (This would be an exception of course.)

I'll file an issue.

Copy link
Contributor

@RichardJCai RichardJCai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @jordanlewis, @knz, and @rohany)

@taroface
Copy link
Collaborator

cc @taroface - this change will also be backported so the corresponding doc update will be multi-version.

@knz Which CRDB versions will receive this update?

@knz
Copy link
Contributor Author

knz commented Feb 25, 2020

Which CRDB versions will receive this update?

19.1 and 19.2 since the previous changes introduced a serious UX regression.
Probably not 2.1 for now but if there's customer pressure we could consider.

Before, the HTTP endpoints would return 500 (Internal server error)
when they require an admin user and a non-admin user was logged in.
This patch changes it to make them return 403 (Forbidden) instead,
which is the standard "permission denied" error code.

Release note (general change): HTTP endpoints now report status
403 (Forbidden) instead of 500 (Internal server error) when the
authenticated user has insufficient privileges to use the endpoint.
Release note (security update): Non-licensed users are now
able to add more principals to the special superuser role/group
`admin`. (Creation of additional roles is still a licensed feature).

Release note (sql change): It is now possible to use `GRANT` and
`REVOKE` to add users to the `admin` role without a valid
license. This change aims to enable use of the admin UI and other
privileged features without a license.
@knz
Copy link
Contributor Author

knz commented Feb 25, 2020

bors r=RichardJCai

@craig
Copy link
Contributor

craig bot commented Feb 25, 2020

Build succeeded

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.

sql: make "GRANT ROLE admin" available to core users
4 participants