capability: Add support for flexible capability name formats#299
capability: Add support for flexible capability name formats#299saschagrunert merged 2 commits intoyouki-dev:mainfrom
Conversation
Normalize capability names to accept both CAP_XXX and XXX formats. This allows users to specify capabilities with or without the CAP_ prefix, improving its flexibility and reducing configuration errors. Implementation: - Strip all "CAP_" prefixes during deserialization Examples: SYS_ADMIN, CAP_SYS_ADMIN, CAP_CAP_SYS_ADMIN -> SYS_ADMIN Fixes youki-dev#298 Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
|
@saschagrunert @utam0k Could you please help take a look ? Appreciate it ! |
saschagrunert
left a comment
There was a problem hiding this comment.
Code LGTM, but please add a test for the new multiple-prefix functionality.
Sure, I will add the related test ASAP. |
It's a UT for the code changes of code changes with enhancement, which aims to test it with one more "CAP_" prefix. Fixes youki-dev#298 Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
@saschagrunert The test has been added, PTAL, Thx . |
|
Let's revert this? This goes against OCI spec, which clearly states:
This increases configuration errors. For example, code that works with this library, but no longer works with other OCI runtime implementation. |
Normalize capability names to accept both CAP_XXX and XXX formats. This allows users to specify capabilities with or without the CAP_ prefix, improving its flexibility and reducing configuration errors.
Implementation:
Examples:
SYS_ADMIN, CAP_SYS_ADMIN, CAP_CAP_SYS_ADMIN -> SYS_ADMIN
Fixes #298
Signed-off-by: Alex Lyn alex.lyn@antgroup.com