safe

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package safe holds shared helpers for the "safe" command wrappers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PathWithin

func PathWithin(root, target string) bool

PathWithin reports whether target is root itself or a descendant of root. Both paths are cleaned lexically before comparison; callers that need symlinks resolved should pass paths through RealPath first.

func RealPath

func RealPath(p string) string

RealPath returns p as an absolute path with symlinks resolved. When the leaf does not exist yet (so it cannot be resolved directly), it resolves symlinks on the longest existing ancestor and re-appends the remaining suffix. This keeps two paths under the same real directory comparable even when the target has not been created yet (e.g. a bind-mount source directory).

Types

type Violation

type Violation struct {
	Source  string
	Service string
	Setting string
}

Violation describes a single reason an invocation was refused. Source is "cli" for command-line rules or "compose" for resolved-model rules. Service is the Compose service name, or "" when the rule is not service-scoped.

func (Violation) String

func (v Violation) String() string

Directories

Path Synopsis
Package dockercompose validates and runs docker compose invocations safely.
Package dockercompose validates and runs docker compose invocations safely.
Package gh implements the "safe gh" wrapper: it parses a gh argv and reports invocations outside a narrow allowlist so the command layer can refuse them.
Package gh implements the "safe gh" wrapper: it parses a gh argv and reports invocations outside a narrow allowlist so the command layer can refuse them.
Package git implements the "safe git" wrapper: it parses a git argv and reports known-dangerous invocations so the command layer can refuse them.
Package git implements the "safe git" wrapper: it parses a git argv and reports known-dangerous invocations so the command layer can refuse them.

Jump to

Keyboard shortcuts

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