You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Unix CLI secret and capability fds read without pipe, size, or time bounds #216
On Unix, hiroute protected-input register --secret-fd and general --capability-fd (everything except work-plans.list / tasks.*) call read_protected_fd in crates/cli/src/client.rs. That helper:
opens /dev/fd/{n} with unbounded std::fs::read
checks the 512-byte limit only after the whole descriptor has been consumed
accepts a regular file, device, or blocking pipe as credential material
The sibling path crates/cli/src/work_plans.rscredential() already requires an inherited FIFO, uses O_NONBLOCK | O_NOCTTY, caps the read at 257 bytes, and applies a 2s deadline. Windows read_protected_handle also bounds bytes and waits 2s. The secret channel used by documented --secret-fd 3 examples does not.
Expected: the protected secret/capability reader rejects stdio, regular files, and non-pipes, and never blocks or loads more than 512 bytes.
Reproduction steps
Synthetic only; do not pass real credentials.
On Linux or macOS, leave a pipe open without EOF, or point --secret-fd at a regular file / /dev/zero.
Correction from the implementation pass: documented --secret-fd usage is an inherited regular file (3< KEY_FILE in the CLI guide) as well as a pipe. Product tests also feed --capability-fd from a regular file. The defect is the unbounded std::fs::read and missing time/type bounds, not acceptance of a regular file.
The intended Unix contract is: reject stdio and non-file/non-pipe nodes (/dev/zero), cap at 512 bytes before loading the rest of the descriptor, and fail a pipe without EOF within 2s. work-plans/tasks capability material stays pipe-only.
Activity
nillikechatchat commentedon Oct 25, 2026
Correction from the implementation pass: documented
--secret-fdusage is an inherited regular file (3< KEY_FILEin the CLI guide) as well as a pipe. Product tests also feed--capability-fdfrom a regular file. The defect is the unboundedstd::fs::readand missing time/type bounds, not acceptance of a regular file.The intended Unix contract is: reject stdio and non-file/non-pipe nodes (
/dev/zero), cap at 512 bytes before loading the rest of the descriptor, and fail a pipe without EOF within 2s.work-plans/taskscapability material stays pipe-only.