pathguard

package
v0.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

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

View Source
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

func Contains(root string, path string) bool

Contains reports whether path resolves inside root. Walks use it to skip a symlinked file whose target lies elsewhere.

func Resolve

func Resolve(root string, path string) (string, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL