Repository navigation
Conversation
|
|
Author
|
The CLA Assistant link for this PR currently displays the ‘SAP Individual Contributor License Agreement’, naming SAP SE as the license recipient. Is this the intended agreement for Pythagora's GPT-Pilot, or should the configured CLA be updated? |
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.
Fixes #1194
Check both the normalized absolute path and its resolved target against the project root. Reject relative traversal, absolute paths outside the root, sibling-directory prefix collisions and existing symlinks that resolve outside the root, before filesystem access. An outside alias pointing into the root is also rejected.
Keep returning the normalized absolute path rather than its resolved target. This preserves
remove()behavior for an in-root file symlink: unlink the alias and leave its target intact. Normalized paths and absolute paths inside the root still work.Testing
python -m pytest tests/disk --no-cov -o addopts="" -ra: 37 passed, 3 skipped. Windows does not permit creating the three real symlink fixtures, so those integration cases were not run successfully here.Path.resolve()while exercising the public VFS operations on real temporary files. The removal test verifies that the alias is actually removed and its target is preserved; the other cases reject outside paths resolving inside the root. All five failed before the follow-up fix and pass afterward.git diff --checkpassed.This is a path-containment check, not a complete sandbox: a malicious process replacing symlinks concurrently can still create a TOCTOU race.
Prepared with AI assistance; tests were run locally.
Follow-up regression coverage
Validate removal paths before applying ignore rules. IgnoreMatcher may stat or open a file; an outside path must be rejected before that inspection, including when a matching ignore rule would otherwise return early.
2 added regressions failed before the follow-up; 37 disk tests passed and 3 real symlink fixtures skipped on Windows. Ruff check/format and git diff --check passed.