registry

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultRegistry is the default Docker Hub registry domain
	DefaultRegistry = "registry-1.docker.io"
	// DockerHubDomain is the canonical short domain for Docker Hub
	DockerHubDomain = "docker.io"
	// DefaultAllowedRegistry is the default registry allowed when no configuration is provided
	DefaultAllowedRegistry = "ghcr.io"
)

Variables

This section is empty.

Functions

func ExtractRegistryDomain

func ExtractRegistryDomain(imageRef string) (string, error)

ExtractRegistryDomain extracts the registry domain from an OCI image reference using the canonical Docker reference parser from github.com/distribution/reference. Returns an error if the image reference is malformed.

Types

type Validator

type Validator struct {
	AllowedRegistries string
}

Validator provides registry validation with configurable allow list. If no allowed registries are configured, it defaults to allowing ghcr.io only.

func NewValidator

func NewValidator(allowedRegistries string) *Validator

NewValidator creates a new Validator with the given allowed registry list. The list is a comma-separated string of registry domains. If empty, defaults to allowing ghcr.io only.

func (*Validator) IsRegistryAllowed

func (v *Validator) IsRegistryAllowed(registry string) bool

IsRegistryAllowed checks if a registry is allowed based on the allow list. If no allowed registries are configured, it defaults to allowing ghcr.io only.

func (*Validator) ValidateImageRegistry

func (v *Validator) ValidateImageRegistry(imageRef string) error

ValidateImageRegistry validates that an image reference uses an allowed registry.

Jump to

Keyboard shortcuts

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