Read and check the docker command file before changing worker directory ownership - #9007
Merged
Merged
Conversation
…ry ownership launch-docker-container now parses the command file before setup_dir_permissions changes the worker directory's ownership. parse_docker_command_file opens the file with O_NOFOLLOW and requires it to be a regular file owned by the worker-launcher user (or root) and not writable by others. run_docker_cmd is split into parse_docker_command_file + exec_docker_cmd so the parse runs first. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
GGraziadei
approved these changes
Aug 23, 2026
| } | ||
|
|
||
| stream = fopen(command_file, "r"); | ||
| int fd = open(command_file, O_RDONLY | O_NOFOLLOW); |
Member
There was a problem hiding this comment.
+1 in using directly posix syscall!
rzo1
approved these changes
Aug 23, 2026
rzo1
approved these changes
Aug 23, 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.
launch-docker-container now parses the command file before setup_dir_permissions changes the worker directory's ownership. parse_docker_command_file opens the file with O_NOFOLLOW and requires it to be a regular file owned by the worker-launcher user (or root) and not writable by others. run_docker_cmd is split into parse_docker_command_file + exec_docker_cmd so the parse runs first.
How this was tested
Built the worker-launcher native tree with
autoreconf -i && ./configure && make check(autotools, compiled with-Werror); the test suite passes.