trust

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupStaged

func CleanupStaged(path string) error

CleanupStaged removes a staged artifact path after failed upgrade/rollback.

Types

type BindingStrategy

type BindingStrategy string

BindingStrategy identifies how verified bytes will be preserved for later launch.

const (
	// BindingDescriptor holds an opened file descriptor (Linux-oriented).
	BindingDescriptor BindingStrategy = "descriptor"
	// BindingProtectedStaging copies into a private digest-addressed store.
	BindingProtectedStaging BindingStrategy = "protected_staging"
	// BindingUnsupported means the host cannot preserve verified identity.
	BindingUnsupported BindingStrategy = "unsupported"
)

type LaunchSource

type LaunchSource = VerifiedArtifact

LaunchSource is an alias documenting Phase 3 consumption of VerifiedArtifact.

type Reason

type Reason string

Reason is a bounded stable trust failure/success code (no paths/secrets).

These constants are outcome codes, not sentinel errors: ReasonOK is a success code, so the Err prefix convention for error sentinels does not apply. The names follow the enum convention (type name prefix + value). Error() is implemented so reasons can be wrapped and matched with errors.Is.

const (
	ReasonOK                  Reason = "ok"
	ReasonPathEscape          Reason = "path_escape"
	ReasonNotRegular          Reason = "not_regular_file"
	ReasonNotExecutableType   Reason = "not_native_executable"
	ReasonUnsupportedPlatform Reason = "unsupported_platform"
	ReasonDigestMismatch      Reason = "digest_mismatch"
	ReasonSubstitution        Reason = "substitution_detected"
	ReasonStagingUnsupported  Reason = "staging_unsupported"
	ReasonStagingFailed       Reason = "staging_failed"
	ReasonRootRequired        Reason = "trusted_root_required"
	ReasonSymlinkEscape       Reason = "symlink_escape"
	ReasonOpenFailed          Reason = "open_failed"
	ReasonACLUnverified       Reason = "acl_unverified"
)

func (Reason) Error

func (r Reason) Error() string

type VerifiedArtifact

type VerifiedArtifact struct {
	Manifest   sdkmanifest.Manifest
	DigestHex  string
	Strategy   BindingStrategy
	StagedPath string // set for protected staging; empty for descriptor binding
	// contains filtered or unexported fields
}

VerifiedArtifact is the digest-bound launch preparation result. It never starts a process; Phase 3 consumes it for exact launch.

func (*VerifiedArtifact) Close

func (v *VerifiedArtifact) Close() error

Close releases held resources (descriptor or staged file handle).

func (*VerifiedArtifact) OpenFile

func (v *VerifiedArtifact) OpenFile() *os.File

OpenFile returns the held descriptor when Strategy is BindingDescriptor.

func (*VerifiedArtifact) Reader

func (v *VerifiedArtifact) Reader() (io.Reader, error)

Reader returns a reader over verified bytes when a file handle is held.

type VerifyOptions

type VerifyOptions struct {
	StagingDir string
	HostOS     string
	HostArch   string
}

VerifyOptions controls digest-bound preparation.

type VerifyResult

type VerifyResult struct {
	Artifact *VerifiedArtifact
	Reason   Reason
	Err      error
}

VerifyResult is either a VerifiedArtifact or a bounded reason.

func Verify

Verify opens the executable under trusted root with no-follow semantics, verifies type/platform/digest from the held handle, and binds for later launch. It never falls back to a raw path when canonicalization fails and never reopens by path after the initial no-follow open for digest verification.

Jump to

Keyboard shortcuts

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