Expand description
Write destinations below a trusted root that refuse symlinked components.
Project data (<project>/.lean-ctx/...) lives inside a working tree that
other people, checkouts and tools can populate. A symlinked .lean-ctx,
proofs or target file there must not redirect a LeanCTX write outside the
project, so these writes rebuild the path component by component below the
trusted root and fail closed on any link. The mechanics (directory handles,
O_NOFOLLOW, renameat) live in lean_ctx_fs::confined_write.
Functionsยง
- project_
data_ destination - Check a destination
<project>/.lean-ctx/<rel>without writing it. - rebuild_
below - Rebuild
root/relcomponent by component, refusing every symlinked component belowroot(a check only; nothing is created). - relative_
below pathas plain components belowroot: lexically first (so a symlinked component stays visible and is refused), then against the canonical root for a caller that already resolved it.- write_
below - Write
contenttoroot/rel(filemodeon Unix), creating missing directories, without following a symlink anywhere belowroot. - write_
project_ data - Write
<project>/.lean-ctx/<rel>: the project root is trusted,.lean-ctxand everything below it must not be a symlink. - write_
requested_ below - Write a caller-chosen destination below
root: the lexicalrequestedpath when it names plain components belowroot(a symlinked component then stays visible and is refused), else the jail-resolvedjailedpath.