Bug 2106086 - IngressController spec.tuningOptions.healthCheckInterval validation allows invalid values such as "0abc"
Summary: IngressController spec.tuningOptions.healthCheckInterval validation allows in...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Networking
Version: 4.11
Hardware: Unspecified
OS: Unspecified
high
urgent
Target Milestone: ---
: 4.12.0
Assignee: Miciah Dashiel Butler Masters
QA Contact: Hongan Li
URL:
Whiteboard:
Depends On:
Blocks: 2106116
TreeView+ depends on / blocked
 
Reported: 2022-07-11 18:20 UTC by Miciah Dashiel Butler Masters
Modified: 2023-01-17 19:52 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-01-17 19:52:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift api pull 1223 0 None Merged Bug 2106086: operator/ingress: Fix healthCheckInterval pattern 2022-07-12 16:25:12 UTC
Github openshift cluster-ingress-operator pull 804 0 None open Bug 2106086: Bump openshift/api for healthCheckInterval fix 2022-07-11 21:32:38 UTC
Red Hat Product Errata RHSA-2022:7399 0 None None None 2023-01-17 19:52:47 UTC

Description Miciah Dashiel Butler Masters 2022-07-11 18:20:25 UTC
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 3 Hongan Li 2022-07-14 06:28:16 UTC
verified with 4.12.0-0.ci-2022-07-13-214326 and passed.

$ oc get clusterversion
NAME      VERSION                         AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.12.0-0.ci-2022-07-13-214326   True        False         97m     Cluster version is 4.12.0-0.ci-2022-07-13-214326

$ 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 4 Miciah Dashiel Butler Masters 2022-07-19 16:58:34 UTC
No doc update is required because this was an issue in a new API.

Comment 7 errata-xmlrpc 2023-01-17 19:52:29 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 (Moderate: OpenShift Container Platform 4.12.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:7399


Note You need to log in before you can comment on or make changes to this bug.