Summary
Add path validation to the mktree helper in internal/checkpoint/store.go to reject or normalize malformed tree entry names before writing checkpoint tree objects. Currently, tree entry names are formatted into git mktree input without any validation (store.go:50-65). If an absolute path or a path with empty segments leaks into a tree entry name, git mktree silently creates a corrupted tree object with empty-filename entries, causing git fsck badTree errors and breaking git bundle create --all.
Solution
Validate each treeEntry.name in the mktree function:
- Reject empty names with an error
- Reject or strip leading
/ (absolute paths)
- Reject names containing empty path segments (e.g.,
foo//bar)
- Reject names containing
. or .. segments
Why
Corrupted tree objects on the checkpoint branch can cascade into repository-wide git failures. Since checkpoints are written on every commit via hooks, a single bad path can silently corrupt the branch. This was discovered in entireio/cli#886 where Windows absolute paths produced empty-named tree entries, and fixed in entireio/cli#902.
Source
Summary
Add path validation to the
mktreehelper ininternal/checkpoint/store.goto reject or normalize malformed tree entry names before writing checkpoint tree objects. Currently, tree entry names are formatted intogit mktreeinput without any validation (store.go:50-65). If an absolute path or a path with empty segments leaks into a tree entry name,git mktreesilently creates a corrupted tree object with empty-filename entries, causinggit fsckbadTreeerrors and breakinggit bundle create --all.Solution
Validate each
treeEntry.namein themktreefunction:/(absolute paths)foo//bar).or..segmentsWhy
Corrupted tree objects on the checkpoint branch can cascade into repository-wide git failures. Since checkpoints are written on every commit via hooks, a single bad path can silently corrupt the branch. This was discovered in entireio/cli#886 where Windows absolute paths produced empty-named tree entries, and fixed in entireio/cli#902.
Source
entireio-cli-issues,entireio-cli-pulls