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

syntheticprivilege: admin always has ALL global privileges #110976

Merged
merged 2 commits into from
Sep 20, 2023

Conversation

rafiss
Copy link
Collaborator

@rafiss rafiss commented Sep 20, 2023

syntheticprivilege: admin always has ALL global privileges

As we move away from requiring the admin role to perform cluster
debug/repair operations, we want to use a privilege instead. To
facilitate that, the admin role now implicitly has ALL global
privileges. The privilege for admins is not revokeable.


sql: use better error message for missing system privilege

Since we document privileges on the GlobalPrivilegeObject using the
phrase "system privilege", we should make the error message say that
too.

informs #109814
Release note: None

As we move away from requiring the admin role to perform cluster
debug/repair operations, we want to use a privilege instead. To
facilitate that, the admin role now implicitly has ALL global
privileges. The privilege for admins is not revokeable.

Release note: None
Since we document privileges on the GlobalPrivilegeObject using the
phrase "system privilege", we should make the error message say that
too.

Release note: None
@rafiss rafiss requested review from fqazi and a team September 20, 2023 16:45
@rafiss rafiss requested a review from a team as a code owner September 20, 2023 16:45
@rafiss rafiss requested review from adityamaru and removed request for a team September 20, 2023 16:45
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@rafiss rafiss added the backport-23.1.x Flags PRs that need to be backported to 23.1 label Sep 20, 2023
Copy link
Collaborator

@fqazi fqazi left a comment

Choose a reason for hiding this comment

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

:LGTM:

One minor test comment, not sure if its feasible

Reviewed 1 of 1 files at r1, 12 of 12 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @adityamaru and @rafiss)


pkg/sql/syntheticprivilegecache/cache.go line 176 at r2 (raw file):

	// Admin always has ALL global privileges.
	if spo.GetObjectType() == privilege.Global {
		privDesc.Grant(username.AdminRoleName(), privilege.List{privilege.ALL}, true)

As a sanity, is there some show statement that will display this that we can pop into a logic test?

Copy link
Collaborator Author

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

tftr!

bors r+

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @adityamaru and @fqazi)


pkg/sql/syntheticprivilegecache/cache.go line 176 at r2 (raw file):

Previously, fqazi (Faizan Qazi) wrote…

As a sanity, is there some show statement that will display this that we can pop into a logic test?

the logic tests already are updated in this PR

@craig
Copy link
Contributor

craig bot commented Sep 20, 2023

This PR was included in a batch that was canceled, it will be automatically retried

@craig
Copy link
Contributor

craig bot commented Sep 20, 2023

Build succeeded:

@craig craig bot merged commit 2a23692 into cockroachdb:master Sep 20, 2023
@rafiss rafiss deleted the system-privilege-cleanup branch September 20, 2023 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.1.x Flags PRs that need to be backported to 23.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants