Skip to content

Commit

Permalink
Remove github.com/pborman/uuid dependency from oc
Browse files Browse the repository at this point in the history
UUIDs are not a valid form of random data.  This change removes the
only direct use of the github.com/pborman/uuid from oc.  Note that
as the code was written, the UUID logic was likely never called.

Signed-off-by: Monis Khan <[email protected]>
  • Loading branch information
enj committed Aug 22, 2018
1 parent 30cdd33 commit 03ed496
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
1 change: 0 additions & 1 deletion hack/import-restrictions.json
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,6 @@
"vendor/github.com/openshift/client-go",
"vendor/github.com/openshift/imagebuilder",
"vendor/github.com/openshift/source-to-image",
"vendor/github.com/pborman/uuid",
"vendor/github.com/prometheus/client_golang",
"vendor/github.com/RangelReale/osincli",
"vendor/github.com/spf13/cobra",
Expand Down
9 changes: 3 additions & 6 deletions pkg/oc/lib/newapp/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"strings"

"github.com/golang/glog"
"github.com/pborman/uuid"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/conversion"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -410,11 +409,9 @@ func (r *DeploymentConfigRef) DeploymentConfig() (*appsapi.DeploymentConfig, err

// GenerateSecret generates a random secret string
func GenerateSecret(n int) string {
n = n * 3 / 4
b := make([]byte, n)
read, _ := rand.Read(b)
if read != n {
return uuid.NewRandom().String()
b := make([]byte, base64.URLEncoding.DecodedLen(n))
if _, err := rand.Read(b); err != nil {
panic(err) // rand should never fail
}
return base64.URLEncoding.EncodeToString(b)
}
Expand Down

0 comments on commit 03ed496

Please sign in to comment.