Skip to content

fix(core): bound untrusted file reads and refuse irregular files - #77

Merged
blackaxgit merged 1 commit into
mainfrom
fix/bounded-bundle-read
Aug 1, 2026
Merged

fix(core): bound untrusted file reads and refuse irregular files#77
blackaxgit merged 1 commit into
mainfrom
fix/bounded-bundle-read

Conversation

@blackaxgit

Copy link
Copy Markdown
Owner
  • Add clx_core::bounded_read: opens then fstats the handle (closing the stat-vs-open TOCTOU window), sets O_NONBLOCK on Unix so a writerless FIFO cannot hang the open itself, rejects non-regular files, caps by size, and still reads via take(cap) against post-fstat growth.
  • Apply at all three untrusted-path reads: credentials.age (16 MiB), project/global instructions files (4 MiB), config-trust target (4 MiB).
  • credentials.age treats non-regular and oversized as hard errors rather than an empty store, so a later set/delete can never re-encrypt an empty map over whatever is actually at that path.

- Add clx_core::bounded_read: opens then fstats the handle (closing the
  stat-vs-open TOCTOU window), sets O_NONBLOCK on Unix so a writerless
  FIFO cannot hang the open itself, rejects non-regular files, caps by
  size, and still reads via take(cap) against post-fstat growth.
- Apply at all three untrusted-path reads: credentials.age (16 MiB),
  project/global instructions files (4 MiB), config-trust target (4 MiB).
- credentials.age treats non-regular and oversized as hard errors rather
  than an empty store, so a later set/delete can never re-encrypt an
  empty map over whatever is actually at that path.
@blackaxgit
blackaxgit merged commit 8ae80ef into main Aug 1, 2026
2 of 3 checks passed
@blackaxgit
blackaxgit deleted the fix/bounded-bundle-read branch August 1, 2026 17:19
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