Skip to content

feat(tracked): add the sidecar, name classification and image walk - #16

Merged
lstocchi merged 1 commit into
redhat-developer:mainfrom
lstocchi:tracked-layer
Nov 26, 2026
Merged

lstocchi merged 1 commit into
redhat-developer:mainfrom
lstocchi:tracked-layer

Conversation

@lstocchi

Copy link
Copy Markdown
Collaborator

Adds the read-only half of the tracked-folder layer, the primitives a following commit builds the create-time baseline on:

  • the tracking sidecar (sidecar.rs): the <image>.ext4kit-tracked JSON that ties an image UUID to a label and the repo-to-target mappings, written atomically (temporary file, sync_all, rename) and validated on read.
  • git-path name classification (names.rs): every name read from the image is agent-controlled bytes, and nothing becomes a git path or gets printed before validate_component classifies it — names the kernel cannot produce, git's verify_path refusals (.git aliases, git~1, .gitmodules as a symlink) and host-incompatible names.
  • the image walk (scan.rs): an iterative DFS over one mapping target through ext4::reader::ImageReader, recording names, kinds, inode numbers, symlink targets and the stability fields but no content. Unreadable or unrepresentable entries become per-path corruption notes instead of aborting the run, and the walk does not descend into nested repositories, .git aliases or host-incompatible names.

The layer reads the image only through ImageReader; no git subprocess is spawned and no CLI surface changes until the following commit. Review focus: the hostile-input handling (agent-controlled names, symlink targets, crafted inodes) and the sidecar's read-side validation.

Adds the read-only half of the tracked-folder layer, the primitives a
following commit builds the create-time baseline on:

* the tracking sidecar (`sidecar.rs`): the `<image>.ext4kit-tracked` JSON
that ties an image UUID to a label and the repo-to-target mappings,
written atomically (temporary file, sync_all, rename) and validated on
read.
* git-path name classification (`names.rs`): every name read from the
image is agent-controlled bytes, and nothing becomes a git path or gets
printed before `validate_component` classifies it — names the kernel
cannot produce, git's `verify_path` refusals (`.git` aliases, `git~1`,
`.gitmodules` as a symlink) and host-incompatible names.
* the image walk (`scan.rs`): an iterative DFS over one mapping target
through `ext4::reader::ImageReader`, recording names, kinds, inode
numbers, symlink targets and the stability fields but no content.
Unreadable or unrepresentable entries become per-path corruption notes
instead of aborting the run, and the walk does not descend into nested
repositories, `.git` aliases or host-incompatible names.

The layer reads the image only through `ImageReader`; no git subprocess is
spawned and no CLI surface changes until the following commit. Review
focus: the hostile-input handling (agent-controlled names, symlink
targets, crafted inodes) and the sidecar's read-side validation.
@lstocchi
lstocchi merged commit 1ee6256 into redhat-developer:main Nov 26, 2026
4 checks passed
@lstocchi
lstocchi deleted the tracked-layer branch November 26, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant