elevator

package
v0.1.0-dev.20260830231949 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package elevator is a STUB / PLACEHOLDER for the privilege-elevation provider — the mechanism that fulfills the elevation policy ([6.1-privilege-elevation.md]). It scaffolds the two strategies (ProcessSpawn / IdentityAssumption), the token-provider broker, and the env-keyed config.

EVERYTHING HERE IS PROVISIONAL. The package name `elevator`, the types `Provider` / `Config` / `Broker` / `Offer` / `Requirement`, and the config shape are WORKING NAMES, to be settled (see 6.1's "Open design work"). Method bodies are not implemented; the provider is not yet announced (no codegen / inventory ride).

[6.1-privilege-elevation.md]: ../../../../docs/architecture/6.1-privilege-elevation.md

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

type Broker struct {
	// contains filtered or unexported fields
}

Broker orchestrates the token-provider drivers (WORKING NAME — it resolves the `ElevationProvider` collision with §6's privileged-process executor). It registers drivers, instantiates the enabled providers from a EnvironmentConfig, and mints on request. STUB.

func NewBroker

func NewBroker() *Broker

NewBroker constructs an empty Broker. STUB.

Returns:

  • `*Broker`: a broker with no registered drivers and no active providers.

func (*Broker) InitializeFromConfig

func (b *Broker) InitializeFromConfig(environment EnvironmentConfig) error

InitializeFromConfig instantiates the enabled token providers for an environment, failing fast on an unsupported driver type. STUB.

TODO(elevation): for each enabled provider, call its factory, `Configure` it, and store the instance in `activeProviders`; then return nil.

Parameters:

  • `environment`: one environment's provisioning (its offers and token-provider definitions).

Returns:

  • `error`: the stub error today; in the target, non-nil on an unsupported or misconfigured driver.

func (*Broker) RegisterDriver

func (b *Broker) RegisterDriver(driverType string, factory func() TokenProvider)

RegisterDriver binds a driver type key to its factory. STUB.

Parameters:

  • `driverType`: the unique driver key (e.g. "aws_sts_assume_role").
  • `factory`: constructs a fresh TokenProvider of that type.

func (*Broker) RequestElevation

func (b *Broker) RequestElevation(ctx context.Context, providerName string, ttl time.Duration) (*SecurityToken, error)

RequestElevation looks up the named provider and mints a token. STUB. Called by the elevate node at runtime.

TODO(elevation): return `provider.MintToken(ctx, ttl)`.

Parameters:

  • `ctx`: the request context.
  • `providerName`: the provider name an offer resolves to in the active environment.
  • `ttl`: the requested token lifetime.

Returns:

  • `*SecurityToken`: the minted token (nil until implemented).
  • `error`: a clear unavailable error for an unknown provider, else the stub error.

type Config

type Config struct {

	// Environments maps an environment name ("dev" / "test" / "stage" / "prod") to its provisioning.
	Environments map[string]EnvironmentConfig `json:"environments" yaml:"environments"`
}

Config is the elevator provider's configuration — the **environment-keyed provisioning** of named offers (WORKING NAME; the devconfig-section integration and the final shape are to be settled — see 6.1's config outline).

PLACEHOLDER SHAPE. The split it encodes: a Requirement (plan-time, saved in the graph) carries a named offer; at run time the named offer is resolved against `Config.Environments[<env>].Offers`; and each environment configures the TokenProviderConfig entries its offers reference. The graph holds *what*; this holds *how*, per environment.

type EnvironmentConfig

type EnvironmentConfig struct {

	// Offers maps a named offer (the graph's `offer_reference_id`) to its realization in THIS environment.
	Offers map[string]Offer `json:"offers" yaml:"offers"`

	// TokenProviders are the provider definitions the offers reference — provider setup, NOT raw long-lived secrets.
	TokenProviders []TokenProviderConfig `json:"token_providers" yaml:"token_providers"`
}

EnvironmentConfig is one environment's offer realizations plus the token-provider definitions they reference. PLACEHOLDER SHAPE.

type Lease

type Lease struct {

	// Provider is the token-provider that granted the elevation.
	Provider string

	// Handle is the lease / JTI handle used to revoke the grant.
	Handle string

	// ExpiresAt is when the grant lapses on its own.
	ExpiresAt time.Time
}

Lease is the compensation state for an acquired elevation — what Provider.CompensateElevate revokes on undo. PLACEHOLDER SHAPE (the "model leases, not just TTL" lesson — see 6.1's prior art).

type Offer

type Offer struct {

	// Strategy selects the elevation mechanism ("host_escalation" | "identity_assumption" | ...).
	Strategy string `json:"strategy" yaml:"strategy"`

	// TokenProvider names the [TokenProviderConfig] that mints this offer's token (empty for `host_escalation`).
	TokenProvider string `json:"token_provider,omitempty" yaml:"token_provider,omitempty"`
}

Offer is the realization of a named offer in an environment: which strategy, and (for `identity_assumption`) which token provider satisfies it. PLACEHOLDER SHAPE.

type Provider

type Provider struct {
	op.ProviderBase
}

Provider is the privilege-elevation provider (WORKING NAME).

It fulfills the elevation policy via two strategies — `ProcessSpawn` (a privileged worker) and `IdentityAssumption` (just-in-time token minting through the Broker). STUB: the methods are unimplemented and the provider is not yet announced.

func NewProvider

func NewProvider(runtimeEnvironment *op.RuntimeEnvironment) *Provider

NewProvider constructs the elevator Provider bound to the runtime environment. STUB.

Parameters:

  • `runtimeEnvironment`: the runtime environment supplying the platform abstraction, the status sink, and (once wired) the Broker built from `Application.Config`.

Returns:

  • `*Provider`: the constructed provider.

func (*Provider) CompensateElevate

func (p *Provider) CompensateElevate(lease *Lease) error

CompensateElevate releases the elevation acquired by Provider.Elevate — revoking the lease / token. STUB.

Parameters:

Returns:

  • `error`: currently always the stub error.

func (*Provider) Elevate

func (p *Provider) Elevate(requirement Requirement) (token *SecurityToken, lease *Lease, err error)

Elevate acquires the elevation a Requirement asks for, returning the minted *SecurityToken plus a *Lease for release on undo. STUB.

TODO(elevation): resolve the named offer (`requirement.OfferReferenceID`) against the runtime environment's Config for the active environment, mint via the Broker (`IdentityAssumption`) or acquire the privileged context (`ProcessSpawn`), and bridge the token by-value down the outgoing edges (see 6.1).

Parameters:

  • `requirement`: the plan-time elevation ask carried on the unit/node.

Returns:

  • `*SecurityToken`: the minted token (nil until implemented).
  • `*Lease`: the compensation state for Provider.CompensateElevate (nil until implemented).
  • `error`: currently always the stub error.

type Requirement

type Requirement struct {
	OfferReferenceID         string        `json:"offer_reference_id"          yaml:"offer_reference_id"`
	RequestedTTL             time.Duration `json:"requested_ttl"               yaml:"requested_ttl"`
	RequiredContextAssertion []string      `json:"required_context_assertions" yaml:"required_context_assertions"`
}

Requirement is the **plan-time** elevation ask carried on a graph unit/node and saved into the signed graph: a named offer plus its TTL and context assertions. It is environment-agnostic — the same `OfferReferenceID` resolves to a different realization per environment. PLACEHOLDER SHAPE (the home of these fields on the unit/node is to be settled).

type SecurityToken

type SecurityToken struct {

	// Value is the raw secret or signed JWT payload.
	Value string

	// Mechanism names the credential shape ("BEARER" / "AWS_CREDS" / "KUBECONFIG").
	Mechanism string

	// ExpiresAt is the strict clock limit, for fail-fast node evaluation.
	ExpiresAt time.Time

	// MaskedVars are env vars to inject into the target node, masked in logs.
	MaskedVars map[string]string
}

SecurityToken is the unified, pass-by-value token bridged down graph edges into consumer input slots. PLACEHOLDER SHAPE (see 6.1's token bridge).

func (*SecurityToken) IsExpired

func (t *SecurityToken) IsExpired() bool

IsExpired reports whether the token is past its ExpiresAt.

Returns:

  • `bool`: true when the token is no longer viable.

type TokenProvider

type TokenProvider interface {

	// Configure initializes the driver from untyped config properties.
	Configure(properties map[string]any) error

	// MintToken creates an environment-specific token for the requested TTL.
	MintToken(ctx context.Context, ttl time.Duration) (*SecurityToken, error)

	// Type returns the unique driver key (e.g. "aws_sts_assume_role").
	Type() string
}

TokenProvider is the pluggable minting-driver contract every concrete provider (AWS STS, Kubernetes, Vault, SPIFFE/SPIRE, OIDC) implements. STUB.

type TokenProviderConfig

type TokenProviderConfig struct {
	Name                     string         `json:"name"                       yaml:"name"`
	Type                     string         `json:"type"                       yaml:"type"`
	IsEnabled                bool           `json:"is_enabled"                 yaml:"is_enabled"`
	ConnectionTimeoutSeconds int            `json:"connection_timeout_seconds" yaml:"connection_timeout_seconds"`
	ConfigProperties         map[string]any `json:"config_properties"          yaml:"config_properties"`
}

TokenProviderConfig is a token-provider **driver definition** (`aws_sts_assume_role` / `k8s_token_request` / `hashicorp_vault` / ...). `ConfigProperties` carry provider setup (role ARNs, addresses, mount paths) — NOT raw long-lived credentials; the actual credentials come from the host's credential chain. PLACEHOLDER SHAPE.

Jump to

Keyboard shortcuts

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