Skip to content

Commit ec116a0

Browse files
committed
Remove host name from sigstore paths
See a long meandering discussion in containers#120 . Note that the repo name within a single host is still used within the signstore path, only the host name has been dropped. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
1 parent bc95cd6 commit ec116a0

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

docker/lookaside.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import (
99
"path/filepath"
1010
"strings"
1111

12+
"github.com/Sirupsen/logrus"
13+
"github.com/containers/image/docker/reference"
14+
"github.com/containers/image/types"
1215
"github.com/ghodss/yaml"
1316
"github.com/opencontainers/go-digest"
1417
"github.com/pkg/errors"
15-
16-
"github.com/Sirupsen/logrus"
17-
"github.com/containers/image/types"
1818
)
1919

2020
// systemRegistriesDirPath is the path to registries.d, used for locating lookaside Docker signature storage.
@@ -64,8 +64,8 @@ func configuredSignatureStorageBase(ctx *types.SystemContext, ref dockerReferenc
6464
return nil, errors.Wrapf(err, "Invalid signature storage URL %s", topLevel)
6565
}
6666
// FIXME? Restrict to explicitly supported schemes?
67-
repo := ref.ref.Name() // Note that this is without a tag or digest.
68-
if path.Clean(repo) != repo { // Coverage: This should not be reachable because /./ and /../ components are not valid in docker references
67+
repo := reference.Path(ref.ref) // Note that this is without a tag or digest.
68+
if path.Clean(repo) != repo { // Coverage: This should not be reachable because /./ and /../ components are not valid in docker references
6969
return nil, errors.Errorf("Unexpected path elements in Docker reference %s for signature storage", ref.ref.String())
7070
}
7171
url.Path = url.Path + "/" + repo

docker/lookaside_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func TestConfiguredSignatureStorageBase(t *testing.T) {
4646
dockerRefFromString(t, "//example.com/my/project"), false)
4747
assert.NoError(t, err)
4848
require.NotNil(t, base)
49-
assert.Equal(t, "https://sigstore.example.com/example.com/my/project", (*url.URL)(base).String())
49+
assert.Equal(t, "https://sigstore.example.com/my/project", (*url.URL)(base).String())
5050
}
5151

5252
func TestRegistriesDirPath(t *testing.T) {

0 commit comments

Comments
 (0)