Test the OCI launch-command username and mount-source enforcement - #9014
Merged
Conversation
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>
This was referenced Aug 24, 2026
rzo1
approved these changes
Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 intooci_launch_cmd_matches_user(inoci_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 assertsparse_oci_launch_cmdrejects a source outside the configured directories while accepting one under them. Earlier tests reached onlyis_valid_mount_source; this exercises theis_valid_mountenforcement through the real parse path (confirmed it fails if the mount check is removed).Not covered: the
setup_permissionsfd/dev-ino branch, whose privileged walk runs underseteuid(0)and needs root, which CI'smake checkdoes not run as.