Skip to content

Commit

Permalink
worker: remove namespace whitelist
Browse files Browse the repository at this point in the history
As Clair let developers register their own detectors
  • Loading branch information
Quentin-M authored and jzelinskie committed Feb 24, 2016
1 parent 8be18a0 commit b3ddfbc
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package worker

import (
"errors"
"strings"

"github.com/coreos/clair/database"
"github.com/coreos/clair/utils"
Expand Down Expand Up @@ -46,13 +45,6 @@ var (
// ErrParentUnknown is the error that should be raised when a parent layer
// has yet to be processed for the current layer.
ErrParentUnknown = errors.New("worker: parent layer is unknown, it must be processed first")

// SupportedNamespacePrefixes is the list of namespace prefixes that the worker supports.
// TODO(Quentin-M): We should remove this from here and allow registered Namespace Detectors to
// tell which prefixes are supported. Otherwise, it doesn't make sense to allow registering them.
// Similarly, we could do the same thing with Data Detectors to detect early unsupported
// ImageFormats.
SupportedNamespacePrefixes = []string{"debian:", "ubuntu:", "centos:"}
)

// Process detects the Namespace of a layer, the features it adds/removes, and
Expand Down Expand Up @@ -171,20 +163,6 @@ func detectNamespace(data map[string][]byte, parent *database.Layer) (namespace
}
}

// Ensure that the detected namespace's prefix is supported.
if namespace != nil {
isSupported := false
for _, namespacePrefix := range SupportedNamespacePrefixes {
if strings.HasPrefix(namespace.Name, namespacePrefix) {
isSupported = true
break
}
}
if !isSupported {
return namespace, ErrUnsupported
}
}

return
}

Expand Down

0 comments on commit b3ddfbc

Please sign in to comment.