0217: Fs no-follow attenuation
Status: Accepted
Amends ADR-0095 for explicitly opted-in Fs operations only.
Context
M14.12 needs list/search authority that skips even internal symlinks. Resolve-then-prefix checks cannot protect access against replacement by concurrent writers. Ordinary Fs compatibility must remain unchanged.
Decision
Fs.no_follow() -> Fs explicitly and
monotonically rejects symlinks in every component.
restrict, read_only and repeated
no_follow preserve policy and denial. Policy is
idempotent; attenuation still issues distinct opaque handles.
Policy identity includes the flag and retained-root identity, not
just labels.
Ordinary successful restrict captures a latent
directory descriptor without changing ordinary resolution.
Activation uses that anchor, never its pathname; unavailable
anchors become sticky denied capabilities. Unrestricted activation
retains / and cwd anchors. Later no-follow
restriction selects a child through the retained parent. Root
acquisition is a trusted authority-selection boundary:
restrict(link)?.no_follow() selects the resolved
target, whereas no_follow().restrict(link) denies the
link. This does not authenticate a root substituted before
acquisition or atomically transfer Ws authority by path.
Both backends traverse ordered components with
descriptor-relative openat and
O_NOFOLLOW; link/.. cannot erase a
rejected component. Restricted ascent is denied. Reads consume the
validated descriptor. Rust uses safe existing rustix APIs. Anchors
are invocation-owned, shared/deduplicated and closed once.
Explicit symlink access and prohibited file types return
CliError.Denied; exists returns false.
Internal status 10013 means no-follow filesystem: .
Listing exposes only regular files/directories, sorted as before,
and omits links/disappeared entries. Walks never descend through
links; no-follow Par.walk uses secure serial traversal. File opens
are nonblocking until validated and require regular files with
st_nlink == 1, matching Ws. Writes, append, sync and
truncate validate before mutation; read-only denial retains
precedence.
Alternatives considered
- lstat then pathname open: rejected because replacement races remain.
- Change default Fs: rejected because attenuation must be explicit and compatible.
- Linux-only openat2: rejected because macOS and interpreter parity are required.
- Ws subprocess bridge: rejected because Fs needs direct list/read operations.
Consequences
Retained descriptors consume invocation-lifetime resources; acquisition failures fail closed on activation. Checks bind opened objects, not immutable contents or future link counts. This governs Fs operations, not subprocess path semantics or process sandboxing; Seatbelt and ADR-0215 are unchanged. Linux evidence does not substitute for owner-run macOS verification.