Documentation
¶
Overview ¶
Package policy enforces data egress decisions. Every external call must pass through a Policy before any data leaves the machine. The default mode is Strict, which denies all egress.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEgressDenied = errors.New("policy: egress denied")
ErrEgressDenied indicates the policy forbade an external call.
var ErrLocked = errors.New("policy: locked")
ErrLocked indicates an attempt to change a pinned policy.
var ErrUnknownMode = errors.New("policy: unknown mode")
ErrUnknownMode indicates an unrecognized policy mode name.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Mode is the egress mode name: strict, redacted, or open.
Mode string `json:"mode"`
// Locked pins the policy so user flags cannot change it.
Locked bool `json:"locked"`
// PrivateChannels is "allow" or "deny" for private-channel ingest.
PrivateChannels string `json:"private_channels"`
}
Config is the on-disk policy an organization can ship to pin behavior. When Locked is true, user flags cannot loosen it.
type Mode ¶
type Mode int
Mode is a data egress posture.
type Policy ¶
type Policy struct {
// contains filtered or unexported fields
}
Policy decides whether data may leave the machine. A locked policy is pinned by an organization and cannot be loosened by user flags.
func (Policy) AllowEgress ¶
AllowEgress reports whether sending nbytes to dest is permitted. Strict always denies. Under Redacted and Open it permits; a Redacted caller is responsible for redacting the payload before calling.
func (Policy) AllowPrivateChannels ¶
AllowPrivateChannels reports whether ingesting private channels is permitted. An organization can pin this off; user flags then cannot enable it.
func (Policy) WithMode ¶
WithMode returns a copy at the requested mode. A locked policy cannot change to a different mode and returns ErrLocked.
func (Policy) WithoutPrivateChannels ¶
WithoutPrivateChannels returns a copy that forbids private-channel ingest. This is how an organization pins private ingest off.