Skip to content

fix: allow empty GitRepo subpaths as repository root#3299

Merged
seratch merged 1 commit intomainfrom
fix/git-repo-empty-subpath
May 9, 2026
Merged

fix: allow empty GitRepo subpaths as repository root#3299
seratch merged 1 commit intomainfrom
fix/git-repo-empty-subpath

Conversation

@seratch
Copy link
Copy Markdown
Member

@seratch seratch commented May 9, 2026

This pull request fixes GitRepo.subpath handling so an empty string is treated the same as an omitted subpath and copies the repository root.

The sandbox GitRepo hardening correctly rejects unsafe or ambiguous subpaths before clone/copy, including parent traversal, absolute paths, Windows-style paths, and ".". However, generated manifests from forms, JSON config, or environment-derived inputs may serialize an omitted optional subpath as "". Treating that empty string as invalid creates avoidable compatibility risk without improving the traversal protection, because repository root is already valid when subpath=None.

This change preserves the safety checks for path traversal and non-POSIX subpaths while normalizing subpath="" to the root-copy behavior. Tests cover the new empty-string root behavior and keep "." rejected as an invalid explicit subpath.

@seratch seratch added this to the 0.17.x milestone May 9, 2026
@github-actions github-actions Bot added the bug Something isn't working label May 9, 2026
@seratch seratch enabled auto-merge (squash) May 9, 2026 07:51
@seratch seratch merged commit 9154d83 into main May 9, 2026
10 checks passed
@seratch seratch deleted the fix/git-repo-empty-subpath branch May 9, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working feature:sandboxes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant