workspacefile

package
v0.284.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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

View Source
var ErrOutside = errors.New("the path is outside your workspace")

ErrOutside is a path that resolves outside the root.

Functions

func Resolve

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

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

func ResolveStat(root, p string) (string, os.FileInfo, error)

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.

func Within

func Within(root, p string) bool

Within reports whether p is root or a descendant of it (both cleaned).

Types

This section is empty.

Jump to

Keyboard shortcuts

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