pin

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 8 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 pin checks and opens a pinned provider plugin (providers delta A.2): an absolute path and a sha256, a regular ELF file owned by the user or root, no group or world write on it or any parent, no setuid or setgid bit, no file capabilities. Open returns the file descriptor that was hashed, so the bytes checked are the bytes run.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(path string) error

Check is the load-time test of A.2.3. It never executes or reads more than the ELF magic.

func Open

func Open(path, want string) (*os.File, error)

Open is the spawn-time test of A.2.4: it opens path with O_NOFOLLOW|O_CLOEXEC, re-checks the mode bits and the capability xattr on the open fd, hashes the bytes and compares them with want. The caller execs that same fd.

func Short

func Short(h string) string

Short is the first 12 hex characters of a digest.

func SumFile

func SumFile(path string) (string, error)

SumFile is the sha256 of a file, lowercase hex.

Types

type Changed

type Changed struct{ Path, Want, Got string }

Changed is a plugin whose bytes no longer hash to the pinned sha256.

func (*Changed) Error

func (c *Changed) Error() string

type Error

type Error struct {
	Kind   Kind
	Detail string // KindReason: the reason; KindInsecure: the path
}

Error is a failed pin check.

func (*Error) Error

func (e *Error) Error() string

type Kind

type Kind int

Kind classifies a Check failure; the host-file message of A.8 is built from it.

const (
	KindReason   Kind = iota // missing, symlink, not a regular file, not executable, not an ELF file
	KindInsecure             // Detail names the path that is writable or owned by another user
	KindPrivs                // setuid, setgid or a security.capability xattr
)

Jump to

Keyboard shortcuts

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