Skip to content

Commit

Permalink
Merge pull request #18 from newcontext-oss/namecharacters-bugfix3
Browse files Browse the repository at this point in the history
Reject -name values containing characters CredHub doesn't support
  • Loading branch information
marlon-nc authored Jul 24, 2020
2 parents bc1872e + cefe0ee commit 0e6b654
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions cv.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 0e6b654

Please sign in to comment.