FIX: add validation for containerID#726
Open
kaizakin wants to merge 1 commit into
Open
Conversation
✅ Deploy Preview for urunc canceled.
|
Contributor
Author
|
Hey @cmainas what's your opinion on this comment #714 (comment) |
mdryaan
reviewed
May 30, 2026
Contributor
There was a problem hiding this comment.
Hi @kaizakin, I think two things to fix:
cmd/urunc/utils.go"path/filepath"is in the wrong import group (will fail CI lint)
path/filepath is stdlib it needs to go in the same group as the other stdlib imports, not in its own group between stdlib and external. goimports is enabled in golangci-lint v2 and is checked during golangci-lint run.
go.modrevert thefilepath-securejoinentry
github.com/cyphar/filepath-securejoin is not imported anywhere in the code , validateID only uses stdlib path/filepath. Looks like leftover from an earlier attempt. Revert the go.mod change.
The validation logic and placement look correct.
cc @cmainas
Signed-off-by: karthik balasubramanian <karthikbalasubramanian08@gmail.com>
23636fd to
99fce71
Compare
Contributor
Author
|
Thanks for the review @mdryaan |
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.
Description
containerIDvalidation following the similar approach asruncAlmost every command in urunc
delete,kill,ps,start,run, and the internal re-exec phase calls the sharedgetUnikontainer()helper function to read the container ID from the command line and load its state.by adding
validateIDinside this helper we've automatically secured all commands.only the
createcommand doesn't use the getUnikontainer() because the container state hasn't been initialized yetso i explicitly added validateId there.
How was this tested?
Manually tested by locally compiling urunc and simulating the path traversal attack vector
LLM usage
N/A
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).