Skip to content

Commit

Permalink
fix: allowing regex underscore for container registry enforcement
Browse files Browse the repository at this point in the history
While not best practice, underscore can be used and so should be allowed.
  • Loading branch information
Tom OBrien authored and prometherion committed Oct 27, 2021
1 parent 260b60d commit e361e2d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/webhook/pod/containerregistry_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (r registry) Tag() string {

func NewRegistry(value string) Registry {
reg := make(registry)
r := regexp.MustCompile(`(((?P<registry>[a-zA-Z0-9-.]+)\/)?((?P<repository>[a-zA-Z0-9-.]+)\/))?(?P<image>[a-zA-Z0-9-.]+)(:(?P<tag>[a-zA-Z0-9-.]+))?`)
r := regexp.MustCompile(`(((?P<registry>[a-zA-Z0-9-._]+)\/)?((?P<repository>[a-zA-Z0-9-._]+)\/))?(?P<image>[a-zA-Z0-9-._]+)(:(?P<tag>[a-zA-Z0-9-._]+))?`)
match := r.FindStringSubmatch(value)
for i, name := range r.SubexpNames() {
if i > 0 && i <= len(match) {
Expand Down

0 comments on commit e361e2d

Please sign in to comment.