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

server: replace admin checks with VIEWCLUSTERMETADATA and REPAIRCLUSTERMETADATA #110609

Merged
merged 2 commits into from
Sep 22, 2023

Conversation

rafiss
Copy link
Collaborator

@rafiss rafiss commented Sep 13, 2023

Release note (security update): Endpoints in the admin and status server
that previously required the admin role now can be used by users with
the VIEWCLUSTERMETADATA or REPAIRCLUSTERMETADATA system privilege,
depending on whether the endpoint is read-only or can modify state.

fixes #79571
fixes #109814
Release note: None

@blathers-crl
Copy link

blathers-crl bot commented Sep 13, 2023

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@rafiss rafiss force-pushed the finer-grained-debug-repair-priv-2 branch 2 times, most recently from 71d9091 to b789e35 Compare September 14, 2023 03:22
@rafiss rafiss changed the title syntheticprivilege: admin always has ALL global privileges server: replace admin checks with VIEWCLUSTERMETADATA and REPAIRCLUSTERMETADATA Sep 14, 2023
@rafiss rafiss force-pushed the finer-grained-debug-repair-priv-2 branch 6 times, most recently from 697babe to fc347fb Compare September 20, 2023 22:10
@rafiss rafiss force-pushed the finer-grained-debug-repair-priv-2 branch from fc347fb to 44e9f69 Compare September 21, 2023 16:05
@rafiss rafiss added the backport-23.1.x Flags PRs that need to be backported to 23.1 label Sep 21, 2023
@rafiss rafiss marked this pull request as ready for review September 21, 2023 17:14
@rafiss rafiss requested a review from a team September 21, 2023 17:14
@rafiss rafiss requested review from a team as code owners September 21, 2023 17:14
@rafiss rafiss requested a review from a team September 21, 2023 17:14
@rafiss rafiss requested review from a team as code owners September 21, 2023 17:14
@rafiss rafiss requested review from rhu713, ericharmeling, ecwall and a team and removed request for a team, rhu713 and ericharmeling September 21, 2023 17:14
@rafiss rafiss requested review from a team, Santamaura and dhartunian and removed request for a team September 21, 2023 17:15
Copy link
Collaborator

@dhartunian dhartunian left a comment

Choose a reason for hiding this comment

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

:lgtm: with some minor comments.

Reviewed 8 of 8 files at r1, 1 of 8 files at r2.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @ecwall, @rafiss, and @Santamaura)


-- commits line 10 at r2:
does this need to have a release note noting the security change that allows the new fine-grained permissions?


pkg/server/status.go line 3637 at r1 (raw file):

	// if !isAdmin {
	// 	return nil, privchecker.ErrRequiresAdmin
	// }

nit: remove this?

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.

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @dhartunian, @ecwall, and @Santamaura)


-- commits line 10 at r2:

Previously, dhartunian (David Hartunian) wrote…

does this need to have a release note noting the security change that allows the new fine-grained permissions?

i think the release note would be redundant with the one above and the one i added in #110084 so i opted to put no note here. i can put that in the commit message though.


pkg/server/status.go line 3637 at r1 (raw file):

Previously, dhartunian (David Hartunian) wrote…

nit: remove this?

thanks for the catch!

…ERMETADATA

Release note (security update): Endpoints in the admin and status server
that previously required the admin role now can be used by users with
the VIEWCLUSTERMETADATA or REPAIRCLUSTERMETADATA system privilege,
depending on whether the endpoint is read-only or can modify state.
This commit covers a few cases that were missed by an earlier commit:
cockroachdb#110084. No release note is
included since it would be redundant with the release note from that PR.

Release note: None
@rafiss rafiss force-pushed the finer-grained-debug-repair-priv-2 branch from 44e9f69 to 2325016 Compare September 22, 2023 17:39
@rafiss
Copy link
Collaborator Author

rafiss commented Sep 22, 2023

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Sep 22, 2023

Build succeeded:

@craig craig bot merged commit 235babd into cockroachdb:master Sep 22, 2023
@blathers-crl
Copy link

blathers-crl bot commented Sep 22, 2023

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from 499bbe0 to blathers/backport-release-23.1-110609: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 23.1.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

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.

sql: add system privilege(s) for debug/repair endpoints Remove requirement for Admin role.
3 participants