rancher / dashboard

The Rancher UI
https://rancher.com
Apache License 2.0
463 stars 263 forks source link

Secrets: System not checking the duplicate key values #7645

Open dasarinaidu opened 1 year ago

dasarinaidu commented 1 year ago

Setup :

Rancher version: v2.7-60ab459ac61cae96dfc3145e70e5d3afb9fdf7c8-head Browser type & version: Chrome and Firefox Rancher Installation Type : HA / Docker

Describe the bug : System is NOT indicating user on the duplicate keys , this issue seen while Creating an Opaque Secret by entering duplicate key values / reading from file (which has multiline key-value pairs).

While crating a KEY : System should indicate user if there is a duplicate KEY/invalid key existed on the UI and Create button should not enable until user fix the duplicates. Currently the system is taking duplicate KEY and saving the second one only. No information about the first key Ex: I added key1=value1 and key1=value2 in this case the system is saving the value for key1.

Steps To Reproduce :

  1. Provision rancher
  2. Cluster->Storage->Secrets->Opaque Secret
  3. Go to Create an Opaque Secret
  4. Add two keys with same name but not the value ( Ex : key1=value1 and key1=value2)

Actual Result a. The secrets are saved and for the key1' the second key value is saved b. System is NOT validating duplicate keys with same name c. No UI indication showed to the user on the duplicate keys d. Create button is enabled and user can create Secret

Expected Result a. System should check duplicate of the keys and the text box should turn to Red b. Create button should not enable until user fix the duplicate or invalid key values

Note: This is happening when user giving duplicate keys by manually added OR reading a file and the file contains the duplicate keys

Screenshots image

Additional context

cnotv commented 1 year ago

This requires a custom validation through multiple fields of a dynamic key name. A complex similar case has been for the global settings page