diff --git a/commands.go b/commands.go index f0b6b00..de50d20 100644 --- a/commands.go +++ b/commands.go @@ -243,6 +243,10 @@ func (v *GenerateAndStoreCommand) validateFlags() error { if v.CommonName == "" && len(v.SANDNS) == 0 { return errors.New("you must have a common name or san-dns") } + re := regexp.MustCompile(`[^\w_\-\/]`) + if re.MatchString(v.Name) { + return errors.New("CredHub name can only contain alphanumeric characters plus forward slash, underscore and dash") + } return nil } diff --git a/cv.go b/cv.go index 042579e..c436fcc 100644 --- a/cv.go +++ b/cv.go @@ -250,12 +250,12 @@ func (c CertCompareData) String() string { if c.Left != nil { out += fmt.Sprintf(" Left:%+v ", *c.Left) } else { - out += fmt.Sprintf(" Left: nil ") + out += " Left: nil " } if c.Right != nil { out += fmt.Sprintf(" Right:%+v ", *c.Right) } else { - out += fmt.Sprintf(" Right: nil ") + out += " Right: nil " } return out }