Skip to content

Commit

Permalink
Change sanitization message from error to warning (#7963)
Browse files Browse the repository at this point in the history
Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com>
  • Loading branch information
rikatz authored Nov 23, 2021
1 parent d4a6ade commit c0814c6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions internal/ingress/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ func (n *NGINXController) CheckIngress(ing *networking.Ingress) error {

if cfg.AnnotationValueWordBlocklist != "" {
arrayBadWords = strings.Split(strings.TrimSpace(cfg.AnnotationValueWordBlocklist), ",")
klog.Warningf("Blocklist is %s", cfg.AnnotationValueWordBlocklist)
}

for key, value := range ing.ObjectMeta.GetAnnotations() {
Expand All @@ -260,7 +259,6 @@ func (n *NGINXController) CheckIngress(ing *networking.Ingress) error {
if strings.HasPrefix(key, fmt.Sprintf("%s/", parser.AnnotationsPrefix)) && len(arrayBadWords) != 0 {
for _, forbiddenvalue := range arrayBadWords {
if strings.Contains(value, strings.TrimSpace(forbiddenvalue)) {
klog.Errorf("%s annotation contains invalid word %s", key, forbiddenvalue)
return fmt.Errorf("%s annotation contains invalid word %s", key, forbiddenvalue)
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/ingress/controller/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ func (s *k8sStore) syncIngress(ing *networkingv1.Ingress) {

if s.backendConfig.AnnotationValueWordBlocklist != "" {
if err := checkBadAnnotationValue(copyIng.Annotations, s.backendConfig.AnnotationValueWordBlocklist); err != nil {
klog.Errorf("skipping ingress %s: %s", key, err)
klog.Warningf("skipping ingress %s: %s", key, err)
return
}
}
Expand Down

0 comments on commit c0814c6

Please sign in to comment.