Documentation
¶
Overview ¶
Package scrubexec is the ONE way agentprovision reaches a provisioning driver: a wrapper whose every exec into an agent's container runs with the container's turn credentials removed from its environment.
🔴 WHY A WRAPPER IN ITS OWN PACKAGE. An exec does not inherit ccd's environment (which ccd scrubs); it inherits the CONTAINER's, which holds MUSTER_GATEWAY_BEARER and, for a chief, CCD_GATEWAY_UPSTREAM_BEARER (agentspec.TurnCredentialEnv). A job's git run in the session-writable workspace, or the terminal's long-lived `tmux attach` client (readable at /proc/<pid>/environ by any same-uid process), would otherwise hold them. A helper every call site had to remember was walkable by spelling (an import alias, a local interface assertion, a wrapper elsewhere). Here the raw driver is an UNEXPORTED field of a type in another package: agentprovision cannot read it, so every exec it can make goes through Exec/ExecTTY below. The structural ledger (agentprovision's TestTheRawDriverIsReachableOnlyThroughTheScrub) pins that the adapter stores nothing else.
⚠ IT NEEDS `env` IN THE IMAGE (coreutils or busybox; every exec already needs `sh`). It does not stop an exec'd command from RUNNING as the agent's user — which the session already is — only from seeing the credentials.
Index ¶
- func Command(cmd []string) []string
- type Driver
- func (d Driver) Capabilities() provision.Capabilities
- func (d Driver) Create(ctx context.Context, spec provision.Spec) error
- func (d Driver) Destroy(ctx context.Context, ref provision.Ref) error
- func (d Driver) Driver() string
- func (d Driver) Endpoint(ctx context.Context, ref provision.Ref) (provision.Endpoint, error)
- func (d Driver) Exec(ctx context.Context, ref provision.Ref, cmd []string, stdin io.Reader, ...) error
- func (d Driver) ExecContainer(ctx context.Context, ref provision.Ref, container string, cmd []string, ...) error
- func (d Driver) ExecTTY(ctx context.Context, ref provision.Ref, cmd []string, stdin io.Reader, ...) error
- func (d Driver) Get(ctx context.Context, ref provision.Ref) (provision.Instance, error)
- func (d Driver) List(ctx context.Context) ([]provision.Instance, error)
- func (d Driver) Scale(ctx context.Context, ref provision.Ref, replicas int) error
- func (d Driver) StreamLogs(ctx context.Context, ref provision.Ref, emit func(line string)) error
- func (d Driver) Update(ctx context.Context, spec provision.Spec) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver is a provision.Provisioner whose Exec and ExecTTY strip the turn credentials. It deliberately exposes NO way back to the driver it wraps.
func Wrap ¶
func Wrap(raw provision.Provisioner) Driver
Wrap is the only constructor. agentprovision.New calls it once, on Config.Driver, and keeps nothing else.
func (Driver) Capabilities ¶
func (d Driver) Capabilities() provision.Capabilities
func (Driver) Exec ¶
func (d Driver) Exec(ctx context.Context, ref provision.Ref, cmd []string, stdin io.Reader, stdout, stderr io.Writer) error
Exec runs Command(cmd) through the wrapped driver.
func (Driver) ExecContainer ¶ added in v0.110.0
func (d Driver) ExecContainer(ctx context.Context, ref provision.Ref, container string, cmd []string, stdin io.Reader, stdout, stderr io.Writer) error
ExecTTY runs Command(cmd) on a terminal through the wrapped driver. ExecContainer is Exec into a named container (a key holder's): the same prefix, though no turn credential is in that container's environment — every exec this wrapper passes carries it, so none can be added without it.