Skip to content

capability: Add support for flexible capability name formats#299

Merged
saschagrunert merged 2 commits intoyouki-dev:mainfrom
Apokleos:enhance-caps
Nov 4, 2025
Merged

capability: Add support for flexible capability name formats#299
saschagrunert merged 2 commits intoyouki-dev:mainfrom
Apokleos:enhance-caps

Conversation

@Apokleos
Copy link
Copy Markdown
Contributor

@Apokleos Apokleos commented Nov 3, 2025

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 #298

Signed-off-by: Alex Lyn alex.lyn@antgroup.com

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>
@Apokleos
Copy link
Copy Markdown
Contributor Author

Apokleos commented Nov 3, 2025

@saschagrunert @utam0k Could you please help take a look ? Appreciate it !

Copy link
Copy Markdown
Contributor

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM, but please add a test for the new multiple-prefix functionality.

@Apokleos
Copy link
Copy Markdown
Contributor Author

Apokleos commented Nov 4, 2025

Code LGTM, but please add a test for the new multiple-prefix functionality.

Sure, I will add the related test ASAP.
Thx a lot

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>
@Apokleos
Copy link
Copy Markdown
Contributor Author

Apokleos commented Nov 4, 2025

Code LGTM, but please add a test for the new multiple-prefix functionality.

@saschagrunert The test has been added, PTAL, Thx .

@saschagrunert saschagrunert merged commit e5c8012 into youki-dev:main Nov 4, 2025
16 checks passed
@stepancheg
Copy link
Copy Markdown
Contributor

Let's revert this? This goes against OCI spec, which clearly states:

Valid values are defined in the capabilities(7) man page, such as CAP_CHOWN.

reducing configuration errors

This increases configuration errors. For example, code that works with this library, but no longer works with other OCI runtime implementation.

@stepancheg
Copy link
Copy Markdown
Contributor

#321

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement of Deserialize for Capabities within OCI Runtime Spec

3 participants