Skip to content

OCPBUGS-81271: Trim subnet input in UDN creation form#425

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
pcbailey:bug-fix/81271--trim-cidr-udn-form
Jun 3, 2026
Merged

OCPBUGS-81271: Trim subnet input in UDN creation form#425
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
pcbailey:bug-fix/81271--trim-cidr-udn-form

Conversation

@pcbailey
Copy link
Copy Markdown
Contributor

@pcbailey pcbailey commented Jun 3, 2026

Trim subnet input in the UserDefinedNetwork creation form to avoid error on submit.

Jira: https://redhat.atlassian.net/browse/OCPBUGS-81271

Summary by CodeRabbit

  • Bug Fixes
    • Network creation form: subnet CIDR input now safely handles empty values, trims whitespace, and splits entries cleanly so pasted or comma-separated input is processed correctly while validation remains enabled.

@openshift-ci-robot openshift-ci-robot added jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Jun 3, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@pcbailey: This pull request references Jira Issue OCPBUGS-81271, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @lkladnit

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Trim subnet input in the UserDefinedNetwork creation form to avoid error on submit.

Jira: https://redhat.atlassian.net/browse/OCPBUGS-81271

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot requested a review from lkladnit June 3, 2026 12:59
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c9fe3fa9-5566-4e96-8d02-ea8f12788cff

📥 Commits

Reviewing files that changed from the base of the PR and between 3eb792e and 97beb73.

📒 Files selected for processing (1)
  • src/views/udns/list/components/UserDefinedNetworkCreateForm.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/views/udns/list/components/UserDefinedNetworkCreateForm.tsx

Walkthrough

The subnet CIDR TextInput onChange now defensively parses input: it null-checks, splits by commas, trims each segment, filters out empty entries, and then calls setValue with the cleaned subnet array (validation still enabled).

Changes

Subnet Input Sanitization

Layer / File(s) Summary
Subnet input sanitization
src/views/udns/list/components/UserDefinedNetworkCreateForm.tsx
The subnet TextInput onChange handler now null-checks input, splits by commas only when present, trims whitespace from each segment, filters out empty segments, and passes the sanitized array to setValue with validation enabled.

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: trimming subnet input in the UDN creation form, which matches the defensive parsing of subnet CIDR field that trims whitespace and filters empty segments.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed Check not applicable: This TypeScript/React repository has no Ginkgo tests. The PR only modifies a React component without adding or changing test files.
Test Structure And Quality ✅ Passed Custom check for Ginkgo test quality is not applicable—this is a TypeScript/React project with no Ginkgo tests and no test files were modified in this PR.
Microshift Test Compatibility ✅ Passed No Ginkgo e2e tests are added in this PR. The commit modifies only TypeScript/React UI form components in an OpenShift console plugin; no Go test files are present.
Single Node Openshift (Sno) Test Compatibility ✅ Passed This PR modifies a React component for subnet input handling, not Ginkgo e2e tests. The SNO compatibility check applies only when new e2e tests are added; this PR adds none.
Topology-Aware Scheduling Compatibility ✅ Passed Change modifies only a React console plugin UI form component for input validation. No deployment manifests, operator code, controllers, or scheduling constraints are introduced.
Ote Binary Stdout Contract ✅ Passed This PR modifies a TypeScript React UI component in a console plugin, not a test binary. OTE Stdout Contract check applies only to Go test binaries.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR contains no Ginkgo e2e tests. Changes are to a TypeScript React form component for trimming subnet CIDR input. Check is not applicable to this UI component change.
No-Weak-Crypto ✅ Passed PR modifies only UserDefinedNetworkCreateForm.tsx for subnet CIDR input trimming. No weak cryptographic patterns, custom crypto implementations, or secret comparisons detected.
Container-Privileges ✅ Passed PR only modifies React UI component; no Kubernetes/container manifests changed. Existing container configs use non-root user and deny privilege escalation.
No-Sensitive-Data-In-Logs ✅ Passed No logging of sensitive data found. Subnet CIDR input is processed and stored in form state with no console logging of subnet values in the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot requested review from galkremer1 and metalice June 3, 2026 12:59
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 3, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@pcbailey: This pull request references Jira Issue OCPBUGS-81271, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @lkladnit

Details

In response to this:

Trim subnet input in the UserDefinedNetwork creation form to avoid error on submit.

Jira: https://redhat.atlassian.net/browse/OCPBUGS-81271

Summary by CodeRabbit

  • Bug Fixes
  • Improved subnet input handling in the network creation form to properly trim whitespace and safely process empty values, preventing potential input errors.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/views/udns/list/components/UserDefinedNetworkCreateForm.tsx`:
- Line 69: The setValue call for subnetField is producing [""] when the input is
cleared because "".trim().split(',') yields [""]; update the assignment in the
UserDefinedNetworkCreateForm so that the value passed to setValue is either an
empty array (or undefined per backend expectation) when the trimmed newValue is
empty — e.g. compute const subnets = newValue?.trim() ?
newValue.trim().split(',').map(s => s.trim()).filter(Boolean) : [] and pass
subnets into setValue(subnetField, ...); ensure you reference the existing
subnetField and setValue usage to locate the change.
- Line 69: The current call to setValue(subnetField,
newValue?.trim()?.split(','), ...) only trims the whole string and leaves
whitespace on individual CIDR entries; update the logic in
UserDefinedNetworkCreateForm where setValue is invoked to first split the input
by ',' then map over the resulting array to trim each CIDR and filter out any
empty strings (handle nullable newValue), and pass that cleaned array to
setValue(subnetField, ...), preserving the existing options object.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1335b910-37d8-4074-813b-448615290b3c

📥 Commits

Reviewing files that changed from the base of the PR and between 0380051 and 3eb792e.

📒 Files selected for processing (1)
  • src/views/udns/list/components/UserDefinedNetworkCreateForm.tsx

Comment thread src/views/udns/list/components/UserDefinedNetworkCreateForm.tsx Outdated
@pcbailey pcbailey force-pushed the bug-fix/81271--trim-cidr-udn-form branch from 3eb792e to 97beb73 Compare June 3, 2026 14:31
@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jun 3, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Jun 3, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: avivtur, pcbailey

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Jun 3, 2026

@pcbailey: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot Bot merged commit f5d4e5c into openshift:main Jun 3, 2026
6 checks passed
@openshift-ci-robot
Copy link
Copy Markdown

@pcbailey: Jira Issue OCPBUGS-81271: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-81271 has been moved to the MODIFIED state.

Details

In response to this:

Trim subnet input in the UserDefinedNetwork creation form to avoid error on submit.

Jira: https://redhat.atlassian.net/browse/OCPBUGS-81271

Summary by CodeRabbit

  • Bug Fixes
  • Network creation form: subnet CIDR input now safely handles empty values, trims whitespace, and splits entries cleanly so pasted or comma-separated input is processed correctly while validation remains enabled.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants