Skip to content

Commit

Permalink
Remove host name from sigstore paths
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mtrmac committed Mar 30, 2017
1 parent bc95cd6 commit ec116a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions docker/lookaside.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import (
"path/filepath"
"strings"

"github.com/Sirupsen/logrus"
"github.com/containers/image/docker/reference"
"github.com/containers/image/types"
"github.com/ghodss/yaml"
"github.com/opencontainers/go-digest"
"github.com/pkg/errors"

"github.com/Sirupsen/logrus"
"github.com/containers/image/types"
)

// systemRegistriesDirPath is the path to registries.d, used for locating lookaside Docker signature storage.
Expand Down Expand Up @@ -64,8 +64,8 @@ func configuredSignatureStorageBase(ctx *types.SystemContext, ref dockerReferenc
return nil, errors.Wrapf(err, "Invalid signature storage URL %s", topLevel)
}
// FIXME? Restrict to explicitly supported schemes?
repo := ref.ref.Name() // 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
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
Expand Down
2 changes: 1 addition & 1 deletion docker/lookaside_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestConfiguredSignatureStorageBase(t *testing.T) {
dockerRefFromString(t, "//example.com/my/project"), false)
assert.NoError(t, err)
require.NotNil(t, base)
assert.Equal(t, "https://sigstore.example.com/example.com/my/project", (*url.URL)(base).String())
assert.Equal(t, "https://sigstore.example.com/my/project", (*url.URL)(base).String())
}

func TestRegistriesDirPath(t *testing.T) {
Expand Down

0 comments on commit ec116a0

Please sign in to comment.