Repository navigation
Validation for Upstream and Locator git.directory fields - #4837
Open
mozesl-nokia wants to merge 2 commits into
Open
mozesl-nokia wants to merge 2 commits into
mozesl-nokia wants to merge 2 commits into
Conversation
Assisted-by: Cursor:grok-4.7 Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
mozesl-nokia
requested review from
efiacor,
kispaljr and
liamfallon
as code owners
October 28, 2026 16:06
✅ Deploy Preview for kptdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The path validation accepts mixed-separator paths that escape the repository on Linux/macOS, leaving fetch/update guards vulnerable to directory traversal.
1 open issue
What changed in this PR
This PR adds validation for Git directory paths in kpt package metadata and fetch operations to prevent upward traversal outside cloned repositories.
Changes:
- Adds shared directory validation for
UpstreamandLocatorGit fields. - Applies validation to fetch and direct cloning entry points.
- Adds tests for valid paths, traversal attempts, and NUL bytes.
| File | Description |
|---|---|
pkg/lib/util/fetch/fetch.go |
Adds directory checks before fetching and cloning. |
pkg/lib/util/fetch/fetch_test.go |
Tests traversal rejection at fetch and cloning entry points. |
api/kptfile/v1/validation.go |
Implements shared validation and integrates it into metadata checks. |
api/kptfile/v1/validation_test.go |
Tests metadata validation and directory path cases. |
Review effort: Balanced
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
|
This branch has not been deployed
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.




The
git.directoryfield of theUpstreamandLocatortype are now part of validation, preventing potential upward path traversal out of the repositories' directory.AI disclaimer: