docker/lookaside.go
func configuredSignatureStorageBase(sys *types.SystemContext, ref dockerReference, write bool) (signatureStorageBase, error) {
	// FIXME? Loading and parsing the config could be cached across calls.
	dirPath := registriesDirPath(sys)
	logrus.Debugf(`Using registries.d directory %s for sigstore configuration`, dirPath)
	config, err := loadAndMergeConfig(dirPath)
	if err != nil {
		return nil, err
	}

	topLevel := config.signatureTopLevel(ref, write)
	if topLevel == "" {
		return nil, nil
	}

	url, err := url.Parse(topLevel)
	if err != nil {
		return nil, errors.Wrapf(err, "Invalid signature storage URL %s", topLevel)
	}
	// NOTE: Keep this in sync with docs/signature-protocols.md!
	// FIXME? Restrict to explicitly supported schemes?
	repo := reference.Path(ref.ref) // Note that this is without a tag or digest.
	if path.Clean(repo) != repo {   // Coverage: This should not be reachable because /./ and /../ components are not valid in docker references
		return nil, errors.Errorf("Unexpected path elements in Docker reference %s for signature storage", ref.ref.String())
	}
	url.Path = url.Path + "/" + repo
	return url, nil
}
func configuredSignatureStorageBase(sys *types.SystemContext, ref dockerReference, write bool) (signatureStorageBase, error) {
	// FIXME? Loading and parsing the config could be cached across calls.
	dirPath := registriesDirPath(sys)
	logrus.Debugf(`Using registries.d directory %s for sigstore configuration`, dirPath)
	config, err := loadAndMergeConfig(dirPath)
	if err != nil {
		return nil, err
	}

	topLevel := config.signatureTopLevel(ref, write)
	if topLevel == "" {
		return nil, nil
	}

	url, err := url.Parse(topLevel)
	if err != nil {
		return nil, errors.Wrapf(err, "Invalid signature storage URL %s", topLevel)
	}
	// NOTE: Keep this in sync with docs/signature-protocols.md!
	// FIXME? Restrict to explicitly supported schemes?
	repo := reference.Path(ref.ref) // Note that this is without a tag or digest.
	if path.Clean(repo) != repo {   // Coverage: This should not be reachable because /./ and /../ components are not valid in docker references
		return nil, errors.Errorf("Unexpected path elements in Docker reference %s for signature storage", ref.ref.String())
	}
	url.Path = url.Path + "/" + repo
	return url, nil
}
func configuredSignatureStorageBase ( sys * types . SystemContext , ref dockerReference , write bool ) ( signatureStorageBase , error ) { // FIXME? Loading and parsing the config could be cached across calls. dirPath := registriesDirPath ( sys ) logrus . Debugf ( `Using registries.d directory %s for sigstore configuration` , dirPath ) config , err := loadAndMergeConfig ( dirPath ) if err != nil { return nil , err } topLevel := config . signatureTopLevel ( ref , write ) if topLevel == " " { return nil , nil } url , err := url . Parse ( topLevel ) if err != nil { return nil , errors . Wrapf ( err , " " , topLevel ) } // NOTE: Keep this in sync with docs/signature-protocols.md! // FIXME? Restrict to explicitly supported schemes? repo := reference . Path ( ref . ref ) // Note that this is without a tag or digest. if path . Clean ( repo ) != repo { // Coverage: This should not be reachable because /./ and /../ components are not valid in docker references return nil , errors . Errorf ( " " , ref . ref . String ( ) ) } url . Path = url . Path + " " + repo return url , nil }
// configuredSignatureStorageBase reads configuration to find an appropriate signature storage URL for ref, for write access if “write”.
configuredSignatureStorageBase reads configuration to find an appropriate signature storage URL for ref for write access if “write” .