Skip to content

[bug bash] Unknown Linux capability names in an ActorTemplate are rejected at admission - #3487

Merged
Eitan Yarmush (EItanya) merged 2 commits into
agent-substrate:mainfrom
BenTheElder:capability-names
Oct 30, 2026
Merged

Eitan Yarmush (EItanya) merged 2 commits into
agent-substrate:mainfrom
BenTheElder:capability-names

Conversation

@BenTheElder

Copy link
Copy Markdown
Collaborator

Part of #3226.

We only checked the shape of capability names, so a typo passed admission. In add it failed at actor start, and on microVM kata-agent panics converting it (trans.rs). In drop it was ignored, so drop: [NET_BIND_SERVIC] kept NET_BIND_SERVICE.

Names are now checked against the 41 Linux capabilities, the same set runsc (specutils.go) and kata's oci-spec (capability.rs) accept. atelet runs the same check on Run and Restore.

AI use: AI-assisted, I reviewed it.

Breaking change: a template with an unknown name in drop is now rejected, check drop lists for typos. Unknown names in add already failed at actor start.

  • Tests pass
  • Docs updated

kata-agent panics on a capability name it can't parse, and an unknown name in drop was silently ignored

Signed-off-by: Benjamin Elder <[email protected]>
// linuxCapabilities are the Linux capability names, in bit order, without the
// "CAP_" prefix (which is added when the OCI spec is written). runsc and
// kata-agent accept exactly these, and kata-agent panics on any other name.
var linuxCapabilities = sets.New(

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

NOTE: new capabilities are rare, and even if the kernel gains them, we still have to get them in kata and gvisor first. The last time was kernel 5.8-5.9 adding a few AFAICT.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think rejecting unknown names at admission is a good idea, but this validation should be just for a better UX (i.e. fail-fast), not for correctness. I think that at runtime we should fail with a proper error message if an actor is asked for a CAP which is not supported.

This way, if we ever extend this list with a new CAP which is not supported across all runtimes, we don't regress.

Comment thread internal/resources/validate.go Outdated
case !capabilityRE.MatchString(c):
errs = append(errs, field.Invalid(p, c, "must be an uppercase capability name like 'NET_BIND_SERVICE'"))
case !linuxCapabilities.Has(c):
errs = append(errs, field.Invalid(p, c, "must be a Linux capability name like 'NET_BIND_SERVICE'"))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Other enumeration string fields are reported as field.NotSupported so we should be consistent and use it here as well.

@BenTheElder

Copy link
Copy Markdown
Collaborator Author

This way, if we ever extend this list with a new CAP which is not supported across all runtimes, we don't regress.

I think we just ... won't do that. It will require careful review. And it should be very rare. The last time linux added a capability was 2020 AFAICT.

@EItanya Eitan Yarmush (EItanya) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I agree with Julian Gutierrez Oschmann (@juli4n)'s review that we should add this to the worker side, but I think this is a good step

@EItanya
Eitan Yarmush (EItanya) added this pull request to the merge queue Oct 30, 2026
Merged via the queue into agent-substrate:main with commit 75a061c Oct 30, 2026
7 checks passed
@BenTheElder
Benjamin Elder (BenTheElder) deleted the capability-names branch October 30, 2026 23:20
Dmitry Berkovich (dberkov) pushed a commit that referenced this pull request Oct 31, 2026
… ActorTemplate are rejected at admission (#3514)

Cherry-pick of #3487 onto `release-1.0` (`git cherry-pick -x` of the
squash commit), it applied cleanly with no changes.

Capability names in `add` and `drop` are checked against the 41 Linux
capabilities at admission, and atelet runs the same check on Run and
Restore. Before, a typo in `add` failed at actor start and a typo in
`drop` was ignored. Part of #3226.

AI use: AI-assisted. Clean pick.

This carries the same breaking change as #3487: a template with an
unknown name in `drop` is now rejected, check `drop` lists for typos.
Unknown names in `add` already failed at actor start.

- [x] Tests pass
- [x] Docs updated

Signed-off-by: Benjamin Elder <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api User-facing API changes area/gvisor area/microVM area/node breaking-change PRs with breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants