← Back to issue list

fix(organize): reject sources outside install dir

View original Github issue

Metadata

Project
craft-parts
Number
#1562
Type
pull request
State
merged
Author
gcomneno
Labels
—
Created
Updated
Closed

Current evaluation

Merged PR #1562 as commit 32b95b4f, rejecting organize sources outside the install directory while preserving existing symlink behavior.

Resolution: closed resolved

Reason: PR #1562 was merged in commit 32b95b4f. It validates resolved source paths against the install directory while retaining the original path for organization, allowing outward-pointing symlinks without permitting path traversal.

Evaluated by: mr-cal-bot

No scores available.

Issue body

## Summary Reject `organize` source entries that resolve outside the part install directory. This fixes cases where `organize` could read from absolute paths or use directory traversal to escape the install directory. ## Testing - `ruff check craft_parts/executor/organize.py tests/unit/executor/test_organize.py tests/unit/features/partitions/executor/test_organize.py` - `pytest -q tests/unit/executor/test_organize.py -rs` - `pytest -q tests/unit/features/partitions/executor/test_organize.py -rs` ## Notes This keeps normalized in-tree paths working, such as `dir/../foo`, while rejecting absolute and escaping source paths.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged PR #1562 as commit 32b95b4f, rejecting organize sources outside the install directory while preserving existing symlink behavior.
stealth/space-bunny-alpha — closed resolved Merged #1562 in commit 32b95b4f, rejecting organize sources outside the install directory while preserving symlinks; unrelated CI failures did not block the merge.
qwen/qwen3.6-35b-a3b — — Merged fix preventing the organize step from processing sources outside the part install directory. Blocks absolute paths and directory traversal while preserving symlink behavior. Unrelated CI failures did not block the merge.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1525 Directory traversal issue when organizing a part craft-parts closed Fixed by merged PR #1562 (commit 32b95b4f), rejecting organize sources that escape the install directory via absolute paths or traversal.
76%
#1544 fix: prevent organizing a directory into itself craft-parts closed PR #1544 was closed unmerged as incomplete; the solution was replaced by the organize-from-build rework in #1598 (commit cc02958b).
74%
#690 fix(organize): use the part's install directories (#689) craft-parts merged Merged PR #690 in commit 0eff7cc9 (change c349e740), fixing organize_files() to use part install directories and organize under base_dir.
73%