Documentation
¶
Overview ¶
Package workspacefile confines a path an agent names to the directory it works in: THE ONE rule every caller that reads an agent-named file off a filesystem muster-server cannot see applies — an officer pod's ask image (internal/podagent, `ccd ask-image`), a dispatched pod's ask attachment (`ccd ask-attach`) and a mirrored session's attention_ask attachments (internal/mirrorhost's MCP proxy, against the session's working directory).
🔴 THE PATH IS RESOLVED BEFORE IT IS OPENED. A relative path is joined to the root, an absolute one taken as is; every symlink on either is resolved (filepath.EvalSymlinks, the root's own included); the result must lie inside the resolved root and be a regular file. `..`, an absolute path elsewhere and a symlink out are all refused (ErrOutside). So is anything whose resolved location below the root has a part starting with "." — a dotfile, or a file in a dot-directory such as .ssh, .aws or .git (ErrHidden).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrHidden = errors.New(`the path is a hidden file or inside a hidden directory (a part of it starts with "."), which is never uploaded`)
ErrHidden is a path that resolves to a hidden file, or into a hidden directory, below the root: a component starting with "." (.env, .ssh, .aws, .git). Those hold credentials and repository internals far more often than anything an owner should be shown, so they are never uploaded.
var ErrOutside = errors.New("the path is outside your workspace")
ErrOutside is a path that resolves outside the root.
Functions ¶
func Resolve ¶
Resolve is p resolved inside root, or an error: p relative is joined to root; every symlink on either is resolved; the result must be root itself's descendant (ErrOutside otherwise) and a regular file.
func ResolveStat ¶
ResolveStat is Resolve, and the file it confined as it stood then: what an opener compares the file it opened with (os.SameFile), so a file swapped in between the two is refused rather than read.
Types ¶
This section is empty.