-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
sql, server: add new system privileges for observability #85280
Conversation
3bccb5e
to
fb679c4
Compare
Some tests that don't seem related seem to fail so might be missing something re: adding the new builtin roles. Edit: irrelevant now |
080a490
to
cc5f81e
Compare
cc5f81e
to
3f7d07c
Compare
3f7d07c
to
8cf565d
Compare
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.
LGTM other than nit about error message in version gate. We should return the old error message about admin user
pkg/server/admin.go
Outdated
if c.st.Version.IsActive(ctx, clusterversion.SystemPrivilegesTable) { | ||
hasViewClusterMetadata = c.checkHasSystemPrivilege(ctx, userName, privilege.VIEWCLUSTERMETADATA) | ||
} | ||
if !hasViewClusterMetadata { |
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.
I think this should go into the IsActive
since if it's not active, we can't actually grant VIEWCLUSTERMETADATA
pkg/server/admin.go
Outdated
if c.st.Version.IsActive(ctx, clusterversion.SystemPrivilegesTable) { | ||
hasViewDebug = c.checkHasSystemPrivilege(ctx, userName, privilege.VIEWDEBUG) | ||
} | ||
if !hasViewDebug { |
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.
Ditto
for observability This patch introduces 2 new system privileges VIEWDEBUG and VIEWCLUSTERMETADATA. VIEWDEBUG will now be used to gate taking traces and viewing debug endpoints. VIEWCLUSTERMETADATA will now be used to gate the node and range reports. Resolves cockroachdb#83844, cockroachdb#83856, cockroachdb#83857, cockroachdb#83858, cockroachdb#83861 Release note (sql change): add VIEWDEBUG and VIEWCLUSTERMETADATA system privileges.
8cf565d
to
71f0298
Compare
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.
Ack
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @adityamaru, @koorosh, @rhu713, @RichardJCai, and @zachlite)
pkg/server/admin.go
line 3563 at r2 (raw file):
Previously, RichardJCai (Richard Cai) wrote…
I think this should go into the
IsActive
since if it's not active, we can't actually grantVIEWCLUSTERMETADATA
Done
pkg/server/admin.go
line 3584 at r2 (raw file):
Previously, RichardJCai (Richard Cai) wrote…
Ditto
Done
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.
LGTM modulo nits
codes.PermissionDenied, "this operation requires the %s system privilege", | ||
privilege.VIEWDEBUG) | ||
} | ||
} else { |
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.
nit: don't need else, I think linter might complain about this too
codes.PermissionDenied, "this operation requires the %s system privilege", | ||
privilege.VIEWCLUSTERMETADATA) | ||
} | ||
} else { |
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.
nit: don't need else, I think linter might complain about this too
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.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @adityamaru, @koorosh, @rhu713, @RichardJCai, @Santamaura, and @zachlite)
pkg/server/admin.go
line 3565 at r3 (raw file):
Previously, RichardJCai (Richard Cai) wrote…
nit: don't need else, I think linter might complain about this too
@RichardJCai wouldn't we need the else, if the user doesn't have admin but has the privilege it would hit the admin error without the else right?
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.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @adityamaru, @koorosh, @rhu713, @RichardJCai, @Santamaura, and @zachlite)
pkg/server/admin.go
line 3565 at r3 (raw file):
Previously, Santamaura (Alex Santamaura) wrote…
@RichardJCai wouldn't we need the else, if the user doesn't have admin but has the privilege it would hit the admin error without the else right?
I meant we can return without the else.
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.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @adityamaru, @koorosh, @rhu713, @RichardJCai, @Santamaura, and @zachlite)
pkg/server/admin.go
line 3565 at r3 (raw file):
Previously, RichardJCai (Richard Cai) wrote…
I meant we can return without the else.
I'm a kind of confused, if we omit the else the scenario I mentioned above will occur or am I going crazy?
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.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @adityamaru, @koorosh, @rhu713, @RichardJCai, @Santamaura, and @zachlite)
pkg/server/admin.go
line 3565 at r3 (raw file):
Previously, Santamaura (Alex Santamaura) wrote…
I'm a kind of confused, if we omit the else the scenario I mentioned above will occur or am I going crazy?
if {
...
return ...
} else {
return ...
}
is the same as just
if {
...
return ...
}
return ...
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.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @adityamaru, @koorosh, @rhu713, @RichardJCai, @Santamaura, and @zachlite)
pkg/server/admin.go
line 3565 at r3 (raw file):
Previously, RichardJCai (Richard Cai) wrote…
if { ... } else { return ... }
is the same as just
if { ... } return ...
Wait sorry I read the brackets wrong and there has to be a return in the if
Per our async discussion I will go ahead and bors it |
bors r+ |
Build succeeded: |
This patch introduces 2 new system privileges
VIEWDEBUG and VIEWCLUSTERMETADATA. VIEWDEBUG
will now be used to gate taking traces and viewing
debug endpoints. VIEWCLUSTERMETADATA will now be
used to gate the node and range reports.
Resolves #83844, #83856, #83857, #83858, #83861
Release note (sql change): add VIEWDEBUG and
VIEWCLUSTERMETADATA system privileges.