Documentation
¶
Index ¶
Constants ¶
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 ¶
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 ¶
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 ¶
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 ¶
ValidateImageRegistry validates that an image reference uses an allowed registry.