Kuadrant/kuadrant-console-plugin

DNSPolicy ProviderRefs Empty String Bypass

開放

#468 建立於 2026年5月19日

 (1 則留言) (0 個反應) (1 位負責人)TypeScript (63 個分叉)auto 404
buggood first issuetriage/accepted

倉庫指標

星標
 (10 顆星)
PR 合併指標
 (平均合併 2天 23小時) (30 天內合併 53 個 PR)

描述

Describe the bug The DNSPolicy creation form allows submission of an invalid providerRefs array containing an empty string. This occurs when a user types a value into the "Provider Refs" input field and subsequently clears it. The frontend form validation only checks if the array length is greater than 0, bypassing the required field validation and generating an invalid Kubernetes resource. To Reproduce

  1. Go to 'Kuadrant -> Policies -> DNS' in the OpenShift Console.
  2. Click on 'Create DNS Policy'.
  3. Scroll down to the 'Provider Refs' input field.
  4. Type any character (e.g., 'aws') into the input field.
  5. Delete the text so the input field is completely empty.
  6. Fill in the remaining required fields (Policy Name, Target Gateway).
  7. Notice that the 'Create' button remains enabled. Click it and see the K8s API validation error.

Expected behavior The form validation should detect that the providerRefs name is an empty string and correctly disable the 'Create' button.

Additional context In KuadrantDNSPolicyCreatePage.tsx, the onChange handler wraps the cleared input into an array [{ name: "" }]. The form validation expression providerRefs.length > 0 evaluates to true because the array has a length of 1, ignoring the fact that the actual name value is an empty string.

貢獻者指南