Documentation
¶
Overview ¶
Package pathguard keeps every file operation inside the workspace.
Jade is asked to leave running beside an agent. That claim cannot stand while an edit given "../../.ssh/config", an absolute path, or a symlink that points out of the repository writes wherever it lands. Every path a caller or a language server hands to Jade resolves through Resolve before it is read or written, so the rule lives in one place instead of eighteen.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrOutsideWorkspace = errors.New("outside the workspace")
ErrOutsideWorkspace reports a path that resolves outside the workspace root, lexically or through a symlink.
Functions ¶
func Contains ¶
Contains reports whether path resolves inside root. Walks use it to skip a symlinked file whose target lies elsewhere.
func Resolve ¶
Resolve returns the absolute path for path inside root, or an error naming the root when it escapes.
Relative paths join the root; absolute paths are accepted only when they already lie inside it. The returned path is lexical — spelled under root as given, not under its symlink-resolved form — so callers computing paths relative to root keep getting the same answer. The symlink check runs on the deepest part of the path that exists, which also covers a file about to be created inside a symlinked directory.
Types ¶
This section is empty.