-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
Enhance the root permission, when root role exist, it always return rootPerm. #13006
Conversation
@@ -200,7 +200,7 @@ func (s *simplePrinter) RoleGet(role string, r v3.AuthRoleGetResponse) { | |||
} else { | |||
fmt.Printf("\t[%s, <open ended>", sKey) | |||
} | |||
if v3.GetPrefixRangeEnd(sKey) == sRangeEnd { | |||
if v3.GetPrefixRangeEnd(sKey) == sRangeEnd && len(sKey) > 0 { |
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.
When sKey is empty, GetPrefixRangeEnd
will return []byte{0}, it will be same with rootPerm rangeEnd []byte{0}.
And when sKey is empty, it shouldn't show prefix.
So modify it.
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.
Out of curiosity: What's wrong with showing 'empty' prefix. Prefixes are IMHO easier to understand than ranges.
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.
it will show:
Role root
KV Read:
[, <open ended> (prefix )
KV Write:
[, <open ended> (prefix )
It's not the expected when role is root
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.
In fact, the empty prefix is no sense.
85f4073
to
5b2c038
Compare
Codecov Report
@@ Coverage Diff @@
## main #13006 +/- ##
===========================================
- Coverage 63.41% 52.34% -11.07%
===========================================
Files 439 426 -13
Lines 34119 33688 -431
===========================================
- Hits 21637 17635 -4002
- Misses 10435 14219 +3784
+ Partials 2047 1834 -213
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
992805f
to
a162a62
Compare
…ootPerm. etcdctl role grant-permission root readwrite foo. see etcdctl role get root output. Before: Role root KV Read: foo KV Write: foo After: Role root KV Read: [, <open ended> KV Write: [, <open ended>
a162a62
to
d223f91
Compare
Thanks! |
After #12979.
We need make the server-side return "".."\x00" always when asked about the root.
The
root
role should be