Help us shape the future of Go! Take the 2026 Go Developer Survey

registryfixture

package
v1.24.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MPL-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package registryfixture owns the bounded Linux registry/proxy and helper fixtures used by native provider-consumer tests.

Index

Constants

View Source
const (
	// #nosec G101 -- This is an environment variable name, not a credential value.
	CredentialConfigEnv = "CASE_A_CREDENTIAL_CONFIG"
	// #nosec G101 -- This is an environment variable name, not a credential value.
	CredentialLogEnv = "CASE_A_CREDENTIAL_OBSERVATIONS"
	// #nosec G101 -- This is an environment variable name, not a credential value.
	CredentialRootEnv      = "CASE_A_CREDENTIAL_ROOT"
	CredentialOperationEnv = "CASE_A_OPERATION_ID"
	HelperBinaryName       = "docker-credential-fixture"
)
View Source
const RegistryHost = "registry.invalid"

Variables

This section is empty.

Functions

func CredentialHelperMain

func CredentialHelperMain(args []string, stdin io.Reader, stdout, stderr io.Writer) int

CredentialHelperMain implements Docker's credential-helper `get` wire protocol. The input is recorded only as an owned server key and parent PID; the secret is read from a private fixture file and never logged.

func DispatchCredentialHelper

func DispatchCredentialHelper() (handled bool, exitCode int)

DispatchCredentialHelper runs the helper only for the fixed private-root path when it resolves to the current executable. handled is false for the normal test-binary invocation.

func IsCredentialHelperInvocation

func IsCredentialHelperInvocation(argv0 string) bool

IsCredentialHelperInvocation recognizes only the fixed helper path under the configured private root, when it resolves to this running test binary.

Types

type Config

type Config struct {
	Username string
	Password string
}

type CredentialConfig

type CredentialConfig struct {
	OperationID            string `json:"operation_id"`
	ServerKey              string `json:"server_key"`
	Username               string `json:"username,omitempty"`
	Secret                 string `json:"secret,omitempty"`
	CredentialsAvailable   bool   `json:"credentials_available"`
	ExpectedProviderSHA256 string `json:"expected_provider_sha256"`
}

CredentialConfig fields are stored only in the private fixture root.

func ReadCredentialConfig

func ReadCredentialConfig(root, path string) (CredentialConfig, error)

ReadCredentialConfig reads a validated private fixture config. The path must be a direct child of a canonical, current-user-owned mode-0700 root.

type CredentialObservation

type CredentialObservation struct {
	OperationID string          `json:"operation_id"`
	ServerKey   string          `json:"server_key"`
	Action      string          `json:"action"`
	Parent      ProcessIdentity `json:"parent"`
	Outcome     string          `json:"outcome"`
}

CredentialObservation contains secret-free helper invocation evidence.

type ProcessIdentity

type ProcessIdentity struct {
	PID            int    `json:"pid"`
	StartTimeTicks uint64 `json:"start_time_ticks"`
	Executable     string `json:"executable"`
	SHA256         string `json:"sha256"`
}

ProcessIdentity records a live process identity without cmdline or env.

type Request

type Request struct {
	Method        string `json:"method"`
	Path          string `json:"path"` // normalized route class, never the raw URL
	Status        int    `json:"status"`
	Authenticated bool   `json:"authenticated"`
	Bytes         int64  `json:"bytes"`
	BodyDigest    string `json:"body_digest,omitempty"`
	Digest        string `json:"docker_content_digest,omitempty"`
}

type Server

type Server struct {
	Authority string
	ProxyURL  string
	CAPEM     []byte
	Username  string
	Password  string
	// contains filtered or unexported fields
}

Server owns one TLS registry listener and one CONNECT listener. The proxy accepts only the exact registry authority and dials the owned listener IP; it never resolves or forwards caller-selected destinations.

func Start

func Start(next http.Handler, cfg Config) (*Server, error)

func (*Server) Close

func (s *Server) Close(ctx context.Context) error

Close shuts down both listeners and joins servers and active tunnels.

func (*Server) Snapshot

func (s *Server) Snapshot() Snapshot

type Snapshot

type Snapshot struct {
	ConnectAllowed int       `json:"connect_allowed"`
	ConnectDenied  int       `json:"connect_denied"`
	Authenticated  int       `json:"authenticated_requests"`
	AuthRejected   int       `json:"auth_rejected_requests"`
	Completed      int       `json:"completed_responses"`
	ManifestGets   int       `json:"manifest_gets"`
	BlobGets       int       `json:"blob_gets"`
	ResponseBytes  int64     `json:"response_bytes"`
	Requests       []Request `json:"requests"`
}

Jump to

Keyboard shortcuts

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