-
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
etcdserver: do not allow creating empty role #10907
Conversation
Might be a good chance to add more description to the APIs? For example: Lines 114 to 115 in 828225c
Lines 132 to 133 in 828225c
|
Thanks @jingyih I updated the commit, does that look OK? |
@jingyih np and thank you! I initially and naturally thought of doing so i.e. to return error in etcdctl role_command and |
Sounds good. On the server side this can also be done earlier: etcd/etcdserver/api/v3rpc/auth.go Line 56 in fe86a78
|
OK, that sounds great. Thanks @jingyih |
@spzala @jingyih thanks for doing this! I think the error checking should be in the state machine layer as implemented in this PR because it is more defensive than checking in the API layer. Even if something in the API layer is broken by the future change, the state machine layer can deny it. I think it is safer. |
@mitake Thanks for the explanation. It makes sense to me. @spzala I agree we should document the change. What is the current behavior when user try to create a role with empty name? Reading from the bug report, it looks like server will crash, and client will get an error with code = Unavailable. With this PR, client will get an error with code = InvalidArgument. Is my understanding correct? |
@jingyih yup, you understood it correct! I guess this will go in the CHANGELOG-3.4, should I update it under this PR or as a follow up once this gets merged? Thanks! |
I think either is fine. Maybe simply push a commit to update the change log? |
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 after nits.
auth/store.go
Outdated
@@ -796,6 +797,11 @@ func (as *authStore) RoleDelete(r *pb.AuthRoleDeleteRequest) (*pb.AuthRoleDelete | |||
} | |||
|
|||
func (as *authStore) RoleAdd(r *pb.AuthRoleAddRequest) (*pb.AuthRoleAddResponse, error) { | |||
|
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.
remove the leading empty line?
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.
Agree. Thanks!
b7a6554
to
90f410b
Compare
Thanks @jingyih I have also updated the changelog! |
/cc @xiang90 |
Codecov Report
@@ Coverage Diff @@
## master #10907 +/- ##
==========================================
+ Coverage 63.25% 63.31% +0.05%
==========================================
Files 400 400
Lines 37687 37689 +2
==========================================
+ Hits 23839 23861 +22
+ Misses 12252 12232 -20
Partials 1596 1596
Continue to review full report at Codecov.
|
Like user, we should not allow creating empty role. Related etcd-io#10905
@jingyih there was a merge conflict on changelog which I have fixed now. Please take a look now. It will be great if we can merge this one after your final review, considering we may have few more updates on changelog due to 3.4 release, to avoid any further conflicts :-). Thanks! |
lgtm. Thanks for fixing this. |
@jingyih yrw, thank you so much for the quick review!! |
Like user, we should not allow creating empty role.
Related #10905