Documentation
¶
Index ¶
Constants ¶
const ( LevelNone uint8 = iota LevelDegraded LevelFull )
const ( GuaranteeProcessBoundary uint64 = 1 << iota GuaranteeWriteBoundary GuaranteeReadBoundary GuaranteeEnvScrub GuaranteeNetworkBoundary GuaranteeAddressNetwork GuaranteeResourceLimits GuaranteeTargetNetwork )
Variables ¶
var ErrInvalidProfile = errors.New("sandbox: invalid profile")
ErrInvalidProfile identifies malformed, unconstructed, or inconsistent profiles. Details are wrapped for diagnostics; callers may use errors.Is.
Functions ¶
func CanonicalRoot ¶
CanonicalRoot resolves path to an absolute, symlink-free, existing directory. It is the canonicalization every configured root is held to.
func PathWithin ¶
PathWithin reports whether path is root itself or lies beneath it.
Types ¶
type CompileReport ¶
type CompileReport struct {
Entries []ReportEntry
}
CompileReport records enforced, narrowed, and unavailable features.
type Guarantees ¶
type Guarantees struct {
ProcessBoundary bool
WriteBoundary bool
ReadBoundary bool
EnvScrub bool
NetworkBoundary bool
AddressNetwork bool
ResourceLimits bool
TargetNetwork bool
}
Guarantees reports properties actually enforced by the selected backend.
func GuaranteesFromBits ¶
func GuaranteesFromBits(bits uint64) Guarantees
GuaranteesFromBits expands a backend guarantee bitmask into its named form.
func (Guarantees) Bits ¶
func (g Guarantees) Bits() uint64
Bits packs named guarantees back into the bitmask backends report.
type Profile ¶
type Profile struct {
// contains filtered or unexported fields
}
Profile is an immutable, normalized access profile.
func NewProfile ¶
func NewProfile(config ProfileConfig) (*Profile, error)
NewProfile validates, canonicalizes, and owns a copy of config.
func (*Profile) AccessFor ¶
AccessFor returns the fixed numeric Access value for a normalized kind/scope.
func (*Profile) AccessVersion ¶
AccessVersion reports the primitive profile ABI. An unconstructed Profile reports zero, which consumers must reject as unsupported.
func (*Profile) Fingerprint ¶
Fingerprint returns the deterministic digest of all normalized authority.
type ProfileConfig ¶
type ProfileConfig struct {
WorkspaceRoot string
WorkspaceRead Access
WorkspaceWrite Access
HostRead Access
HostWrite Access
Network Access
Command Access
Home Home
Isolation Isolation
AdditionalRoots []RootAccess
AckUnconfined bool
}
ProfileConfig contains every consumer-selected sandbox authority value.
type ReportEntry ¶
ReportEntry records how one requested feature was compiled by a backend.
type RootAccess ¶
RootAccess describes read and write authority for one additional root.
type Settings ¶
type Settings struct {
Version uint16
WorkspaceRoot string
WorkspaceRead Access
WorkspaceWrite Access
HostRead Access
HostWrite Access
Network Access
Command Access
Home Home
Isolation Isolation
AdditionalRoots []RootAccess
AckUnconfined bool
RequiredGuarantees uint64
Fingerprint string
}
Settings is the normalized, read-only view of every authority value a Profile carries. It exists so packages outside this one can compile a Profile without reaching into its unexported fields, which keeps the Profile itself immutable: Settings is a copy, and mutating it cannot affect the Profile it came from.