-
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 getRole output when the role is 'root'. #12979
Conversation
Codecov Report
@@ Coverage Diff @@
## main #12979 +/- ##
==========================================
+ Coverage 46.10% 48.46% +2.35%
==========================================
Files 409 409
Lines 33636 33700 +64
==========================================
+ Hits 15509 16333 +824
+ Misses 16119 15309 -810
- Partials 2008 2058 +50
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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 the role is root, the output of auth v2 seems to be no problem. can you modify auth v3 on the server by referring to the way of auth v2? thanks.
https://github.com/etcd-io/etcd/blob/main/server/etcdserver/api/v2auth/auth.go#L49-L67
Hi, The code already push, I'm not good at it, so I didn't konw the logic is right or not, need your guidance. Thanks. |
ee298fc
to
77a73d4
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.
thanks. LGTM.
Do you have an example output before/after this change? Better if you can write a test for it. |
The response:
|
done. |
LGTM. If tests all pass, please get all commits squashed into one commit. Then it should be good to merge. Thank you! |
1ce84ec
to
aa4341f
Compare
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.
- Please add information to CHANGELOG-3.5
- Please cleanup the commit message to describe what was the behavior before and after the change
aa4341f
to
69a51ab
Compare
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.
I have no experience with permission model and the auth.proto is poorly documented, so forgive my silly questions:
Does it mean that the permission is granted for: where 'range_end' can have special value of: Line 29 in 932d42b
Why do we need to introduce an additional representation of full range ('*') instead of: '' .. '\0' ? |
Hi, In my view, |
One thing we can do is to reuse the range_end thing to donate Alternatively, we can just make |
I
I don't understand. Could you, please, define current/desired semantic of fields in the proto: Lines 25 to 40 in e73facb
would |
I think this change has nothing to do with the actual server side proto. It is just a aesthetics improvement for better command line tool display. Without the change, the perm list for root shows nothing since it is a special case. After this change, it will show something (either |
We can probably use |
For me its a change of server-side implementation and not of |
@ptabor Although we can grant permissions to |
@mitake How do we express in the data-model/proto that not-root user has access to any key ? I would not have any concerns if this was a change in |
@ptabor oops sorry I missed the latest version of this PR... yeah it changes the server side, let me take a look again. The initial version of this PR just changed etcdctl. |
server/auth/store.go
Outdated
@@ -624,6 +627,10 @@ func (as *authStore) UserRevokeRole(r *pb.AuthUserRevokeRoleRequest) (*pb.AuthUs | |||
} | |||
|
|||
func (as *authStore) RoleGet(r *pb.AuthRoleGetRequest) (*pb.AuthRoleGetResponse, error) { | |||
if rootRole == r.Role { |
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 feel this approach is a little bit risky because the result returned by RoleGet()
might be used by other components of etcd server (it should be avoided of course). Also it changes the meaning of the fields. Although v2 employs the similar approach, I prefer the initial approach which only changes etcdctl. Note that v2's auth is based on path and v3's auth is based on prefix, so they are quite different.
How do you think @tangcong ?
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.
Actually *
is a valid etcd key name.
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.
sounds reasonable. we need to be consistent with the existing rules, so we cannot use * on the server-side. How about we use noPrefixEnd? If this PR only changes etcdctl, it looks a little tricky, and there are other languages/sdk that will be called through API.
At now, we can grant permission to |
You are right. I did not give the latest version a closer enough look. Hi, basically there two separate things:
|
Yep, it indeed confuse users. We just modify output of etcdctl get role root.
How about it?
At server, we can grant permission to |
@horizonzy Maybe we should just focus on 1) in this PR. Just fixing the output of etcdctl. We can get the 2) part (server) done later in another PR> |
fine, just modify the output at etcdctl. |
69a51ab
to
0a10619
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.
test, pls.
6d23bf1
to
77e837d
Compare
This comment has been minimized.
This comment has been minimized.
Output:
|
77e837d
to
208a6f9
Compare
Thank you. It looks good to me. Please add a test to As follow up we should make the server-side return "".."\x00" always when asked about the root (in a separate PR). |
208a6f9
to
123a4cf
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.
Thank you.
123a4cf
to
b45167a
Compare
Before output: Role root KV Read: KV Write: After output: Role root KV Read: [, <open ended> KV Write: [, <open ended>
b45167a
to
6ab56fc
Compare
LGTM, merged, thanks! |
For-#12978