Skip to content

Test the OCI launch-command username and mount-source enforcement - #9014

Merged
rzo1 merged 1 commit into
masterfrom
worker-launcher-oci-launch-cmd-tests
Aug 25, 2026
Merged

Test the OCI launch-command username and mount-source enforcement#9014
rzo1 merged 1 commit into
masterfrom
worker-launcher-oci-launch-cmd-tests

Conversation

@reiabreu

Copy link
Copy Markdown
Contributor

Follow-up to #9008 and #9010, adding the test coverage noted on those PRs.

The OCI enforcement points these tests cover live in main.c, which isn't linked into the test binary, so they weren't exercised. This extracts the launch-command username match into oci_launch_cmd_matches_user (in oci_launch_cmd.c, which the test binary does link) and adds two tests:

  • test_oci_launch_cmd_matches_user — the username match (match, mismatch, missing username, null command).
  • test_oci_parse_launch_cmd_mounts — parses a launch command that is valid except for its bind-mount source and asserts parse_oci_launch_cmd rejects a source outside the configured directories while accepting one under them. Earlier tests reached only is_valid_mount_source; this exercises the is_valid_mount enforcement through the real parse path (confirmed it fails if the mount check is removed).

Not covered: the setup_permissions fd/dev-ino branch, whose privileged walk runs under seteuid(0) and needs root, which CI's make check does not run as.

Extracts the launch-command username match from main.c into
oci_launch_cmd_matches_user (defined in oci_launch_cmd.c, which is linked into
the test binary; main.c is not) so it can be unit-tested, and adds two tests:

- test_oci_launch_cmd_matches_user covers the username match directly.
- test_oci_parse_launch_cmd_mounts parses a launch command that is valid except
  for its bind-mount source and asserts parse_oci_launch_cmd rejects a source
  outside the configured directories while accepting one under them, exercising
  the is_valid_mount enforcement that earlier tests only reached at the
  is_valid_mount_source helper level.

Follow-up to the worker-launcher OCI changes in #9008 and #9010.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rzo1
rzo1 merged commit d892aa2 into master Aug 25, 2026
7 checks passed
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.

2 participants