Skip to content

Work - #3

Merged
apostasie merged 5 commits into
mainfrom
work
Aug 16, 2026
Merged

Work#3
apostasie merged 5 commits into
mainfrom
work

Conversation

@apostasie

Copy link
Copy Markdown

No description provided.

apostasie and others added 4 commits August 15, 2026 20:36
Signed-off-by: apostasie <spam_blackhole@farcloser.world>
Signed-off-by: apostasie <spam_blackhole@farcloser.world>
  Two hostile-image checks lived only in the reader.

  Xattrs: the reader rejects an undefined name index (7 upward, which
  used to map to the empty prefix and let an image spell
  "security.capability" in full under it, colliding with the properly
  prefixed entry) and a key listed twice (which was taken last-wins, so
  the parser's iteration order picked which copy a policy decision saw).
  parseXattrsFromBuf, the copyFromImage fast path, still did both — so
  an image the reader refused to Stat would still be copied by
  CopyFrom(MetadataOnly), spoofed capability included. Route its names
  through xattrIndex.prefix(), propagate long-prefix lookup failures
  instead of swallowing them, and reject duplicates; the parser now
  returns an error and copyFromImage fails the copy on it.

  Dirent names: checkDirentName rejects separators and NULs but let a
  zero-length name through. No writer emits one, and as a path element
  it names the directory itself, so a lookup for it silently succeeds;
  ReadDir handed it out as an entry, and the fast path — which strips
  trailing NULs first, so an all-NUL entry became empty — skipped it
  silently. Reject it in checkDirentName, which covers all four parse
  sites, and move the fast path's check ahead of its "."/".." filter so
  the empty case is an error there too. The tampered image in the new
  test shows why this is corruption and not cosmetics: alongside the
  empty entry the neighbouring name reads back as "..a".

  Tests: TestCopyFromImageXattrParity (undefined index, duplicate key —
  both fail on the previous parser) and TestEmptyDirentNameIsRejected
  (reader and CopyFrom; fails on the previous reader with the entry
  list [""  "..a" "b"]).

Signed-off-by: apostasie <spam_blackhole@farcloser.world>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: apostasie <spam_blackhole@farcloser.world>
Signed-off-by: apostasie <spam_blackhole@farcloser.world>
@apostasie
apostasie merged commit 22bd015 into main Aug 16, 2026
12 checks passed
@apostasie
apostasie deleted the work branch August 16, 2026 04:31
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