Bug 1784725 - Console should do special character check when create routing labels
Summary: Console should do special character check when create routing labels
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Management Console
Version: 4.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
: 4.4.0
Assignee: David Taylor
QA Contact: Yadan Pei
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-12-18 07:48 UTC by shahan
Modified: 2020-05-04 11:20 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Create an Alertmanager Receiver, enter "#@$#$%" into a routing label key. Consequence: The receiver will be created, but get an AlertmanagerFailedReload Alert: "Reloading Alertmanager's configuration has failed for openshift-monitoring/alertmanager-main-x." Fix: Added form field validation to Create Receiver form. Result: Now when entering "#@$#$%" into a routing label key there is an field error message: "Invalid name". There is also an info in tooltip: "Label name must not begin with a digit and contain only alphanumeric characters or '_'.". Once cannot save the form until "#@$#$%" is removed from the routing label key/name.
Clone Of:
Environment:
Last Closed: 2020-05-04 11:20:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift console pull 4236 0 None closed Bug 1784725: Console should do special character check when create routing labels 2020-04-17 14:52:23 UTC
Red Hat Product Errata RHBA-2020:0581 0 None None None 2020-05-04 11:20:58 UTC

Description shahan 2019-12-18 07:48:41 UTC
Description of problem:
 Console should do special character check when create routing labels
Version-Release number of selected component (if applicable):
4.3.0-0.nightly-2019-12-13-180405

How reproducible:
Always

Steps to Reproduce:
1. goto monitoring/alertmanagerconfig/receivers/~new page to create new receiver
2. input the required key and Routing Labels's name with special character, like .*% etc.
3. Then create

Actual results:
3. 
token=`oc -n openshift-monitoring sa get-token prometheus-k8s`
 oc -n openshift-monitoring exec -c prometheus prometheus-k8s-1  -- curl -k -H "Authorization: Bearer $token" 'https://prometheus-k8s.openshift-monitoring.svc:9091/api/v1/alerts' | jq
  {
        "labels": {
          "alertname": "AlertmanagerFailedReload",
          "endpoint": "web",
          "instance": "10.128.2.10:9095",
          "job": "alertmanager-main",
          "namespace": "openshift-monitoring",
          "pod": "alertmanager-main-2",
          "service": "alertmanager-main",
          "severity": "warning"
        },
        "annotations": {
          "message": "Reloading Alertmanager's configuration has failed for openshift-monitoring/alertmanager-main-2."
        },
        "state": "firing",
        "activeAt": "2019-12-18T02:34:34.485794182Z",
        "value": "0e+00"
      },

Logs from pod alertmanager-main-2:

level=info ts=2019-12-18T01:55:48.437Z caller=main.go:218 build_context="(go=go1.12.12, user=root@b6ceabe714d3, date=20191213-12:38:42)"
level=info ts=2019-12-18T01:55:48.465Z caller=cluster.go:623 component=cluster msg="Waiting for gossip to settle..." interval=2s
level=info ts=2019-12-18T01:55:48.507Z caller=coordinator.go:119 component=configuration msg="Loading configuration file" file=/etc/alertmanager/config/alertmanager.yaml
level=error ts=2019-12-18T01:55:48.507Z caller=coordinator.go:124 component=configuration msg="Loading configuration file failed" file=/etc/alertmanager/config/alertmanager.yaml err="invalid label name \"trtrt.*\""
Expected results:
Should have validation check like env setting:
 oc set env rc --all "^*^=test"
error: environment variable ^*^=test is invalid, a valid environment variable name must consist of alphabetic characters, digits, '_', '-', or '.', and must not start with a digit (e.g. 'my.env-name',  or 'MY_ENV.NAME',  or 'MyEnvName1', regex used for validation is '[-._a-zA-Z][-._a-zA-Z0-9]*')


Additional info:

Comment 2 Yanping Zhang 2020-02-13 06:53:56 UTC
Tested on ocp 4.4 env with payload 4.4.0-0.nightly-2020-02-12-191550. Create alertmanager receiver, set routing label key with: #@$#$%, there will be info: Invalid name, and there is info in tooltip: Label name must not begin with a digit and contain only alphanumeric characters or '_'.

The bug is fixed, so move it to Verified.

Comment 4 errata-xmlrpc 2020-05-04 11:20:24 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, 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/RHBA-2020:0581


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