Bug 1936883

Summary: ACM UI is not escaping cluster names
Product: Red Hat Advanced Cluster Management for Kubernetes Reporter: Tomas Coufal <tcoufal>
Component: Cluster LifecycleAssignee: cahl
Status: CLOSED ERRATA QA Contact: Derek Ho <dho>
Severity: unspecified Docs Contact: Christopher Dawson <cdawson>
Priority: unspecified    
Version: rhacm-2.2CC: cahl
Target Milestone: ---Flags: ming: rhacm-2.2.z+
Target Release: rhacm-2.2.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-04 20:14:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tomas Coufal 2021-03-09 12:14:11 UTC
Description of problem:
A cluster can't be named "null", "true" or "false", when creating a cluster using ACM UI. The generated YAML doesn't escape cluster names (.metadata.name, .metadata.namespace). 

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Open "Create Cluster" view in ACM
2. Toggle YAML to show the generated manifests
3. Fill in cluster name field with "null", "true", "false"
4. Fill in the rest of the form and hit create (in case of "true" value)

Actual results:
1. Cluster name "null" and "false" results in blank values and ACM erases the field, hence I'm unable to create the cluster.

2. Name "true" results in a wrong data type in .metadata.name and .metadata.namespace fields. ACM doesn't complain and allows user to hit "Create" button. This results in a validation response error with inactive "View details" button:

```
Danger alert:ProjectRequest in version "v1" cannot be handled as a ProjectRequest: v1.ProjectRequest.ObjectMeta: v1.ObjectMeta.Name: ReadString: expects " or n, but found t, error found in #10 byte of ...|:{"name":true}}|..., bigger context ...|o/v1","kind":"ProjectRequest","metadata":{"name":true}}|...
```

Expected results:
Creates the cluster no matter the name, because Kubernetes (RFC 1123) is not restricting from these values.

Additional info:
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-subdomain-names

Comment 7 errata-xmlrpc 2021-05-04 20:14:55 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: Red Hat Advanced Cluster Management 2.2.3 security and bug fix 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-2021:1499