Merge pull request #2120 from adamreese/fix/2115-validate-labels

fix(tiller): enforce release name length on uninstall
pull/2123/head
Adam Reese 8 years ago committed by GitHub
commit 50f4c2bfd0

@ -24,6 +24,7 @@ import (
"io/ioutil"
"log"
"strconv"
"strings"
"time"
"github.com/golang/protobuf/proto"
@ -31,6 +32,7 @@ import (
kberrs "k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
kblabels "k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/util/validation"
rspb "k8s.io/helm/pkg/proto/hapi/release"
)
@ -119,6 +121,9 @@ func (cfgmaps *ConfigMaps) List(filter func(*rspb.Release) bool) ([]*rspb.Releas
func (cfgmaps *ConfigMaps) Query(labels map[string]string) ([]*rspb.Release, error) {
ls := kblabels.Set{}
for k, v := range labels {
if errs := validation.IsValidLabelValue(v); len(errs) != 0 {
return nil, fmt.Errorf("invalid label value: %q: %s", v, strings.Join(errs, "; "))
}
ls[k] = v
}

@ -957,6 +957,10 @@ func (s *ReleaseServer) UninstallRelease(c ctx.Context, req *services.UninstallR
return nil, errMissingRelease
}
if len(req.Name) > releaseNameMaxLen {
return nil, fmt.Errorf("release name %q exceeds max length of %d", req.Name, releaseNameMaxLen)
}
rels, err := s.env.Releases.History(req.Name)
if err != nil {
log.Printf("uninstall: Release not loaded: %s", req.Name)

Loading…
Cancel
Save