canary

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 13 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 canary generates the fake secrets planted inside a sandbox run.

Every value is synthetic, generated fresh for the run, and never derived from the real host environment or filesystem. A value showing up in sandbox output or in an outbound request is evidence the target read it and tried to use or exfiltrate it.

Index

Constants

View Source
const (
	KindAWSKey     = "aws_key"
	KindSSHKey     = "ssh_key"
	KindAPIToken   = "api_token"
	KindDBPassword = "db_password"
	KindFile       = "file"
)

Kind values, mirrored on analyzer.Canary.Kind

View Source
const ContainerHome = "/sandbox/home"

ContainerHome is where the sandbox mounts the directory a Set is materialized into, and the HOME it gives the container

Variables

View Source
var ErrPathEscape = errors.New("canary: path escapes the run directory")

ErrPathEscape is returned by Materialize for a canary file path that is absolute or contains a ".." component

Functions

This section is empty.

Types

type Set

type Set struct {
	RunID    string
	Canaries []analyzer.Canary
	// Files maps a path relative to the fake home root to its content
	Files map[string]string
	// Env is the set of environment variables to inject, all synthetic
	Env map[string]string
}

Set is one run's worth of planted secrets: the analyzer.Canary records handed to the observer, the file tree that backs the file-based ones, and the environment variables to inject into the container

func Generate

func Generate() (*Set, error)

Generate builds a fresh set of synthetic secrets. It never reads os.Environ or any real file; every byte comes from crypto/rand.

func (*Set) Materialize

func (s *Set) Materialize(root string) error

Materialize writes the fake home directory tree under root through os.Root. Lexical checks reject obvious escapes, while kernel-backed resolution remains the actual filesystem boundary.

Jump to

Keyboard shortcuts

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