feat: allow relative target paths for git mounts

- Remove absolute path requirement from target_path validation
- Resolve relative paths against working_directory at instance startup
- Fall back to /home/user if no working_directory is configured
- Update frontend to allow relative target paths
- Update spec to document relative path support
- Update tests to allow relative paths and test path traversal rejection
This commit is contained in:
Alex Blank
2026-05-27 15:01:16 +02:00
parent 8a58c61278
commit 33d08faf70
5 changed files with 15 additions and 10 deletions
@@ -402,8 +402,8 @@ class TestConfigProfilesAPI:
)
assert response.status_code == 422
def test_create_config_profile_invalid_git_mount_target_path(self, authenticated_client: TestClient, test_project_and_repo) -> None:
"""Test that invalid git mount target paths are rejected."""
def test_create_config_profile_invalid_git_mount_target_path_traversal(self, authenticated_client: TestClient, test_project_and_repo) -> None:
"""Test that git mount target paths with traversal are rejected."""
_project_id, repo_id = test_project_and_repo
response = authenticated_client.post(
@@ -416,7 +416,7 @@ class TestConfigProfilesAPI:
{
"remote_url": "https://github.com/user/repo.git",
"source_path": ".",
"target_path": "relative/path",
"target_path": "../../../etc/passwd",
}
],
},