fix: validate volume mount source paths before spawning detached process#3932
Open
stakeswky wants to merge 1 commit intostacklok:mainfrom
Open
fix: validate volume mount source paths before spawning detached process#3932stakeswky wants to merge 1 commit intostacklok:mainfrom
stakeswky wants to merge 1 commit intostacklok:mainfrom
Conversation
Add pre-flight validation in processVolumeMounts() to check that source paths exist on the host filesystem before proceeding. This catches invalid volume mounts early with a clear error message, instead of silently failing in the detached process where the error is only visible in log files. The validation: - Uses os.Stat() (follows symlinks) to check path existence - Resolves relative paths to absolute before checking - Skips validation for Kubernetes operator context (paths are container-relative) - Skips validation for resource:// URIs Fixes stacklok#2485
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.
Summary
Fixes #2485
When running
thv run --volume <source>:<target>with a non-existent source path, the command previously appeared to succeed but the workload would silently enter an error state. The actual error was only visible in the proxy log file.Changes
pkg/runner/config_builder.go— Added pre-flight validation inprocessVolumeMounts():os.Stat()(follows symlinks)resource://URIsvolume mount source path does not exist: /pathpkg/runner/config_builder_test.go— Updated existing tests and added coverage:t.TempDir()for real source paths instead of hardcoded/hostpathsApproach
Implemented Option 1 from the issue (validate in
processVolumeMounts()) because:config_builder.goBefore / After
Before:
After:
$ thv run --volume /nonexistent/path:/app playwright Error: volume mount source path does not exist: /nonexistent/path