-
Notifications
You must be signed in to change notification settings - Fork 86
api: fix OCI hook ownership tracking. #264
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
base: main
Are you sure you want to change the base?
api: fix OCI hook ownership tracking. #264
Conversation
Fix hook ownership tracking and add a proper test case for it. Ownership tracking for OCI hooks is supposed to be accumulative. The implementation tried to accumulate owners, but it was buggy. It tried to delete existing ownership by unclaiming which marks ownershipdeleted by the plugin instead of clearing it. This went unnoticed since we lacked any kind of proper test for hook ownership accumulation. It was only noticed thanks to containerd#263 which switches much of the ownership tracking code to generated from hand-written. Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
b360c00 to
95ba09f
Compare
Verify that a registered plugin name is not empty and only contains characters from the set [a-zA-Z0-9_.+-]. Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
6f103f3 to
91a7760
Compare
| if req.PluginName == "" { | ||
| p.regC <- fmt.Errorf("plugin %q registered with an empty name", p.qualifiedName()) | ||
| return &RegisterPluginResponse{}, errors.New("invalid (empty) plugin name") | ||
| if err := api.CheckPluginName(req.PluginName); err != nil { |
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.
This is technically a breaking change now 😢
I think we should still take it in, but we need to make that clear in release notes.
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.
Yeah, even if we relaxed the new check to only explicitly disallow commas, it still would be a breaking change.
Fix hook ownership tracking and add a proper test case for it.
Ownership tracking for OCI hooks is supposed to be accumulative. The implementation tried to accumulate owners, but it was buggy. It tried to delete existing ownership by unclaiming which marks ownershipdeleted by the plugin instead of clearing it.
This went unnoticed since we lacked any kind of proper test for hook ownership accumulation. It was only noticed thanks to #263 which switches much of the ownership tracking code to generated from hand-written.