Documentation
¶
Overview ¶
Package portalrunner validates protected ephemeral portal-runner definitions and owns their host-side temporary state.
Index ¶
- Constants
- func BuildImage(ctx context.Context, options ImageBuildOptions) (imagePath string, returnError error)
- func CleanupAbandonedRuns(ctx context.Context, stateRoot string) error
- func CleanupRun(stateRoot, runDirectory string) error
- func ConfigureHostedDisplay(ctx context.Context, manifest Manifest, output io.Writer) error
- func CreateRun(stateRoot string) (string, error)
- func HostedDisplayFailureStage(err error) string
- func HostedStreamEvidenceFailureStage(err error) string
- func PrepareStateRoot(path, repositoryRoot string) error
- func ProbeImage(ctx context.Context, options ImageProbeOptions) (returnError error)
- func RunHosted(ctx context.Context, options HostedRuntimeOptions) (returnError error)
- func RunProtectedGNOME(ctx context.Context, options ProtectedRuntimeOptions) (returnError error)
- func ValidateHostedStreamEvidence(display HostedDisplay, screenCastVersion uint32, ...) error
- func WriteHostedDisplayFailureMarker(output io.Writer, err error) error
- type Artifact
- type CONNECTProxy
- type CommandExecutor
- type HostedDisplay
- type HostedOutput
- type HostedRuntimeOptions
- type HostedStreamEvidence
- type ImageBuildOptions
- type ImageProbeOptions
- type Manifest
- type NetworkConfig
- type ProtectedRunIdentity
- type ProtectedRuntimeOptions
- type RedactingWriter
- type StateLock
- type VMConfig
Constants ¶
const ( // HostedCellRemoteDesktop exercises portal-backed pointer and keyboard // input in a disposable desktop guest. HostedCellRemoteDesktop = "remote-desktop" // HostedCellScreenCast exercises persistent portal-backed capture in a // disposable desktop guest. HostedCellScreenCast = "screencast" // HostedCellDisplayBounds exercises read-only public display geometry // without opening a portal session or exposing X11 to the test process. HostedCellDisplayBounds = "display-bounds" // HostedTopologySingle preserves the established one-output portal run. HostedTopologySingle = "single-output" // HostedTopologyMulti enables the manifest-bound two-output experiment. HostedTopologyMulti = "multi-output" )
const ( // ManifestSchemaVersion identifies the protected runner definition format. ManifestSchemaVersion = "1" // HostedGuestEnvKey gates commands that may reconfigure the disposable // hosted guest desktop. HostedGuestEnvKey = "ROBOTGO_HOSTED_GUEST" // HostedExpectedOutputsEnvKey carries the encoded logical topology for // consent-free hosted display-bounds evidence. HostedExpectedOutputsEnvKey = "ROBOTGO_HOSTED_EXPECTED_OUTPUTS" // HostedBoundsVariantEnvKey identifies which public output implementation // the hosted bounds contract is exercising. HostedBoundsVariantEnvKey = "ROBOTGO_HOSTED_BOUNDS_VARIANT" // HostedBoundsVariantNativeCGO identifies the native-CGO Wayland client. HostedBoundsVariantNativeCGO = "native-cgo" // HostedBoundsVariantPureGo identifies the Pure-Go Wayland client. HostedBoundsVariantPureGo = "pure-go" // PortalMultiOutputEnvKey enables the hosted multi-output portal contract. PortalMultiOutputEnvKey = "ROBOTGO_PORTAL_MULTI_OUTPUT" // PortalExpectedOutputsEnvKey carries the encoded hosted output topology. PortalExpectedOutputsEnvKey = "ROBOTGO_PORTAL_EXPECTED_OUTPUTS" )
Variables ¶
This section is empty.
Functions ¶
func BuildImage ¶
func BuildImage( ctx context.Context, options ImageBuildOptions, ) (imagePath string, returnError error)
BuildImage creates or reuses the image identified by the exact manifest digest. It returns a path under the external private state root.
func CleanupAbandonedRuns ¶
CleanupAbandonedRuns stops verified QEMU processes and removes every sentinel-owned transient run under a validated state root. Persistent images and unrelated entries are never removed.
func CleanupRun ¶
CleanupRun removes only a sentinel-owned direct child of the validated state root. Symlinks and unrelated paths fail closed.
func ConfigureHostedDisplay ¶
ConfigureHostedDisplay applies and verifies the manifest-bound topology inside a disposable hosted guest. Callers must independently ensure this is never invoked against a developer desktop.
func HostedDisplayFailureStage ¶
HostedDisplayFailureStage returns only an allowlisted, privacy-safe stage name for a topology failure. It never exposes connector or mode identifiers.
func HostedStreamEvidenceFailureStage ¶
HostedStreamEvidenceFailureStage returns a bounded, privacy-safe validation category without exposing transient portal identifiers.
func PrepareStateRoot ¶
PrepareStateRoot creates or validates private runner storage outside the repository. Images may persist there; per-job overlays are separate runs.
func ProbeImage ¶
func ProbeImage( ctx context.Context, options ImageProbeOptions, ) (returnError error)
ProbeImage proves that the pinned image starts the required local GNOME portal session and can reach an allowlisted HTTPS endpoint only via proxy.
func RunHosted ¶
func RunHosted( ctx context.Context, options HostedRuntimeOptions, ) (returnError error)
RunHosted transfers the exact clean commit into a disposable guest and runs one integration cell. Portal cells drive desktop consent independently through QMP; read-only cells do not create a portal session. The runner does not register a GitHub Actions runner or consume tokens.
func RunProtectedGNOME ¶
func RunProtectedGNOME( ctx context.Context, options ProtectedRuntimeOptions, ) (returnError error)
RunProtectedGNOME boots one visible disposable GNOME VM, binds it to one approved GitHub workflow attempt, and destroys the VM after at most one job.
func ValidateHostedStreamEvidence ¶
func ValidateHostedStreamEvidence( display HostedDisplay, screenCastVersion uint32, streams []HostedStreamEvidence, ) error
ValidateHostedStreamEvidence validates the mandatory stream identity and any optional topology metadata exposed by the negotiated ScreenCast interface without returning transient identifiers in errors.
Types ¶
type Artifact ¶
type Artifact struct {
Version string `json:"version"`
URL string `json:"url"`
SHA256 string `json:"sha256"`
}
Artifact identifies immutable downloaded image content.
type CONNECTProxy ¶
type CONNECTProxy struct {
// contains filtered or unexported fields
}
CONNECTProxy restricts a guest to TLS tunnels for manifest-allowlisted dependency hosts. It never parses or retains tunneled content.
func NewCONNECTProxy ¶
func NewCONNECTProxy(network NetworkConfig) (*CONNECTProxy, error)
NewCONNECTProxy constructs a bounded allowlist proxy.
func (*CONNECTProxy) Serve ¶
Serve handles proxy traffic until context cancellation or a listener error.
func (*CONNECTProxy) ServeHTTP ¶
func (proxy *CONNECTProxy) ServeHTTP(response http.ResponseWriter, request *http.Request)
ServeHTTP accepts only allowlisted HTTPS CONNECT requests.
type CommandExecutor ¶
type CommandExecutor interface {
Run(
ctx context.Context,
name string,
args []string,
stdin io.Reader,
output io.Writer,
) error
}
CommandExecutor runs one host-side provisioning command without exposing command arguments in returned errors.
type HostedDisplay ¶
type HostedDisplay struct {
Outputs []HostedOutput `json:"outputs"`
}
HostedDisplay defines the exact logical monitor topology used by explicit multi-output runs. Outputs are ordered by virtual scanout; the first output is the primary display used for consent interaction.
func ParseHostedDisplay ¶
func ParseHostedDisplay(encoded string) (HostedDisplay, error)
ParseHostedDisplay decodes only the canonical representation emitted by Encode and re-applies every topology safety bound.
func (HostedDisplay) Encode ¶
func (display HostedDisplay) Encode() (string, error)
Encode returns the canonical, non-sensitive environment representation of the exact hosted logical topology.
func (HostedDisplay) Validate ¶
func (display HostedDisplay) Validate() error
Validate rejects ambiguous, overlapping, or unbounded hosted topologies.
type HostedOutput ¶
type HostedOutput struct {
Width int `json:"width"`
Height int `json:"height"`
X int `json:"x"`
Y int `json:"y"`
}
HostedOutput is one logical monitor rectangle in compositor coordinates.
type HostedRuntimeOptions ¶
type HostedRuntimeOptions struct {
ManifestPath string
RepositoryRoot string
StateRoot string
GuestFiles string
SSHPort int
Commit string
Cell string
Topology string
Output io.Writer
Commands CommandExecutor
}
HostedRuntimeOptions identifies one credential-free integration test in a disposable desktop guest running inside a GitHub-hosted Linux runner.
type HostedStreamEvidence ¶
type HostedStreamEvidence struct {
NodeID uint32
ID string
MappingID string
PipeWireSerial uint64
Monitor bool
HasPosition bool
HasSize bool
X int
Y int
Width int
Height int
}
HostedStreamEvidence contains only the transient metadata required to prove one selected monitor stream. Callers must not log or persist the values.
type ImageBuildOptions ¶
type ImageBuildOptions struct {
ManifestPath string
RepositoryRoot string
StateRoot string
GuestFiles string
SSHPort int
Output io.Writer
HTTPClient *http.Client
Commands CommandExecutor
}
ImageBuildOptions defines one immutable portal-runner image build.
type ImageProbeOptions ¶
type ImageProbeOptions struct {
ManifestPath string
RepositoryRoot string
StateRoot string
GuestFiles string
SSHPort int
Output io.Writer
Commands CommandExecutor
}
ImageProbeOptions defines a private non-runner guest boot.
type Manifest ¶
type Manifest struct {
SchemaVersion string `json:"schema_version"`
Lane string `json:"lane"`
Repository string `json:"repository"`
Labels []string `json:"labels"`
BaseImage Artifact `json:"base_image"`
APTSnapshot string `json:"apt_snapshot"`
Go Artifact `json:"go"`
ActionsRunner Artifact `json:"actions_runner"`
VM VMConfig `json:"vm"`
HostedDisplay HostedDisplay `json:"hosted_display"`
Packages []string `json:"packages"`
Network NetworkConfig `json:"network"`
}
Manifest is the complete non-secret definition of one protected runner image and its runtime boundary.
func LoadManifest ¶
LoadManifest decodes and validates a bounded manifest without accepting unknown fields or trailing JSON values.
func (Manifest) MaximumLifetime ¶
MaximumLifetime returns the validated guest lifetime.
func (Manifest) ProxyAddress ¶
ProxyAddress returns the fixed guest-visible proxy endpoint.
type NetworkConfig ¶
type NetworkConfig struct {
ProxyPort int `json:"proxy_port"`
AllowedHosts []string `json:"allowed_hosts"`
}
NetworkConfig is the sole guest egress path during untrusted job execution.
func (NetworkConfig) HostAllowed ¶
func (network NetworkConfig) HostAllowed(value string) bool
HostAllowed reports whether a CONNECT destination is covered by the exact or wildcard-suffix egress set. IP literals and port-bearing hosts are denied.
type ProtectedRunIdentity ¶
type ProtectedRunIdentity struct {
Repository string
Commit string
RunID string
RunAttempt int
Cell string
}
ProtectedRunIdentity binds one disposable runner to one approved workflow attempt and exact repository commit.
type ProtectedRuntimeOptions ¶
type ProtectedRuntimeOptions struct {
ManifestPath string
RepositoryRoot string
StateRoot string
GuestFiles string
SSHPort int
Identity ProtectedRunIdentity
OperatorInput io.Reader
Output io.Writer
Commands CommandExecutor
// contains filtered or unexported fields
}
ProtectedRuntimeOptions identifies one operator-approved disposable runner invocation. OperatorInput must provide the exact line READY only after the private GNOME console is visible and controlled by the operator.
type RedactingWriter ¶
type RedactingWriter struct {
// contains filtered or unexported fields
}
RedactingWriter removes configured non-empty secrets from a stream, including values split across adjacent Write calls.
func NewRedactingWriter ¶
func NewRedactingWriter(destination io.Writer, secrets ...[]byte) (*RedactingWriter, error)
NewRedactingWriter creates a streaming redactor. Secret bytes are copied so callers may clear their source buffers immediately.
func (*RedactingWriter) Flush ¶
func (writer *RedactingWriter) Flush() error
Flush emits the final buffered suffix exactly once.
type StateLock ¶
type StateLock struct {
// contains filtered or unexported fields
}
StateLock prevents concurrent image mutation, probing, and protected runner execution within one private state root.
func AcquireStateLock ¶
AcquireStateLock obtains a non-blocking exclusive lock without following a replacement symlink.