Bug 2106116

Summary: IngressController spec.tuningOptions.healthCheckInterval validation allows invalid values such as "0abc"
Product: OpenShift Container Platform Reporter: OpenShift BugZilla Robot <openshift-bugzilla-robot>
Component: NetworkingAssignee: Miciah Dashiel Butler Masters <mmasters>
Networking sub component: router QA Contact: Shudi Li <shudili>
Status: CLOSED ERRATA Docs Contact:
Severity: urgent    
Priority: high CC: bbennett, hongli, mmasters, wking
Version: 4.11   
Target Milestone: ---   
Target Release: 4.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-08-10 11:20:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2106086    
Bug Blocks:    

Description OpenShift BugZilla Robot 2022-07-11 19:21:24 UTC
+++ This bug was initially created as a clone of Bug #2106086 +++

Description of problem:

OpenShift 4.11 adds a new API field to IngressController: spec.tuningOptions.healthCheckInterval.  This field has the following validation:

 	// +kubebuilder:validation:Pattern=^0|([0-9]+(\.[0-9]+)?(ns|us|µs|μs|ms|s|m|h))+$

Note that the left subgroup includes the "^" anchor, and the right subgroup includes the "$" anchor.  The validation should be the following:

 	// +kubebuilder:validation:Pattern=^(0|([0-9]+(\.[0-9]+)?(ns|us|µs|μs|ms|s|m|h))+)$


OpenShift release version:

4.11.0


Cluster Platform:

All platforms.


How reproducible:

Easily.


Steps to Reproduce (in detail):
1. Set a value for spec.tuningOptions.healthCheckInterval with a leading 0 and any arbitrary suffix.


Actual results:

Any value with a leading 0 is accepted:

    % oc -n openshift-ingress-operator patch ingresscontroller/default --type=merge --patch='{"spec":{"tuningOptions":{"healthCheckInterval":"0abc"}}}'
    ingresscontroller.operator.openshift.io/default patched

Expected results:

Only 0 or a number with an optional decimal part and with a unit should be accepted:

    % oc -n openshift-ingress-operator patch ingresscontroller/default --type=merge --patch='{"spec":{"tuningOptions":{"healthCheckInterval":"0abc"}}}'
    The IngressController "default" is invalid: spec.tuningOptions.healthCheckInterval: Invalid value: "0abc": spec.tuningOptions.healthCheckInterval in body should match '^(0|([0-9]+(\.[0-9]+)?(ns|us|µs|μs|ms|s|m|h))+)$'


Impact of the problem:

Users can set invalid values.


Additional info:

This API field is new in OpenShift 4.11.0.

Comment 4 Hongan Li 2022-07-14 08:17:38 UTC
verified with 4.11.0-0.ci-2022-07-13-194139 and passed

$ oc get clusterversion
NAME      VERSION                         AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.11.0-0.ci-2022-07-13-194139   True        False         65m     Cluster version is 4.11.0-0.ci-2022-07-13-194139


$ oc -n openshift-ingress-operator patch ingresscontroller/default --type=merge --patch='{"spec":{"tuningOptions":{"healthCheckInterval":"0abc"}}}'
The IngressController "default" is invalid: spec.tuningOptions.healthCheckInterval: Invalid value: "0abc": spec.tuningOptions.healthCheckInterval in body should match '^(0|([0-9]+(\.[0-9]+)?(ns|us|µs|μs|ms|s|m|h))+)$'

Comment 6 errata-xmlrpc 2022-08-10 11:20:54 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: OpenShift Container Platform 4.11.0 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:5069