Skip to content

Conversation

@Thealisyed
Copy link

@Thealisyed Thealisyed commented Nov 20, 2025

Add route path validation to reject # or whitespace
Add ValidatePath function and integrate it with ValidateRoute
and ValidateRouteUpdate to reject routes with '#' or spaces in spec.path

Validation changes:

  • Add ValidatePath to check for # and spaces in route paths
  • Call the library-go validation and add additional path validation

This ensures our PR matches the validation logic introduced
in https://github.com/openshift/library-go/pull/2012/files

@coderabbitai
Copy link

coderabbitai bot commented Nov 20, 2025

Important

Review skipped

Auto reviews are limited based on label configuration.

🚫 Review skipped — only excluded labels are configured. (1)
  • do-not-merge/work-in-progress

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

@Thealisyed Thealisyed force-pushed the validation419 branch 3 times, most recently from 9a12467 to bf076ca Compare November 27, 2025 12:06
Add ValidatePath function and integrate it with ValidateRoute
and ValidateRouteUpdate to reject routes with '#' or spaces in spec.path

Validation changes:
- Add ValidatePath to check for # and spaces in route paths
- Call the library-go validation and add additional path validation

This ensures our PR matches the validation logic introduced
in https://github.com/openshift/library-go/pull/2012/files

   Assisted with Claude Code
Comment on lines +63 to +66
if external.Spec.Path != oldExternal.Spec.Path {
pathFieldPath := field.NewPath("spec", "path")
allErrs = append(allErrs, validatePath(external.Spec.Path, pathFieldPath)...)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

OK, the update validation is ratcheting, so it won't block updates to preexisting routes with this problem.

@benluddy
Copy link
Contributor

/lgtm
/label backport-risk-assessed

@openshift-ci openshift-ci bot added the backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. label Dec 17, 2025
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 17, 2025
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 17, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: benluddy, Thealisyed

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 openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 17, 2025
@Thealisyed Thealisyed changed the title Adding validation directly and calling existing library-go validation OCPBUGS-61662: Adding validation directly and calling existing library-go validation Dec 17, 2025
@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important 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 Dec 17, 2025
@openshift-ci-robot
Copy link

@Thealisyed: This pull request references Jira Issue OCPBUGS-61662, which is valid.

7 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.19.z) matches configured target version for branch (4.19.z)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
  • release note text is set and does not match the template
  • dependent bug Jira Issue OCPBUGS-47773 is in the state Closed (Done), which is one of the valid states (VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA))
  • dependent Jira Issue OCPBUGS-47773 targets the "4.20.0" version, which is one of the valid target versions: 4.20.0, 4.20.z
  • bug has dependents

Requesting review from QA contact:
/cc @ShudiLi

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

Details

In response to this:

Add route path validation to reject # or whitespace
Add ValidatePath function and integrate it with ValidateRoute
and ValidateRouteUpdate to reject routes with '#' or spaces in spec.path

Validation changes:

  • Add ValidatePath to check for # and spaces in route paths
  • Call the library-go validation and add additional path validation

This ensures our PR matches the validation logic introduced
in https://github.com/openshift/library-go/pull/2012/files

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 ShudiLi December 17, 2025 17:01
@ShudiLi
Copy link
Member

ShudiLi commented Dec 18, 2025

/label cherry-pick-approved

@ShudiLi
Copy link
Member

ShudiLi commented Dec 18, 2025

Tested it with 4.19.0-0-2025-12-18-101436-test-ci-ln-thv6cr2-latest

1.
% oc get clusterversion
NAME      VERSION                                                AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.19.0-0-2025-12-18-101436-test-ci-ln-thv6cr2-latest   True        False         31m     Cluster version is 4.19.0-0-2025-12-18-101436-test-ci-ln-thv6cr2-latest

2.
% oc -n test get route unsec-apach -o=jsonpath="{.metadata.annotations}"
{"haproxy.router.openshift.io/rewrite-target":"/","openshift.io/host.generated":"true"}%  

3.
% oc -n test patch route/unsec-apach --type=merge --patch '{"spec": {"path": "/route-admission-test#2"}}'
The Route "unsec-apach" is invalid: spec.path: Invalid value: "/route-admission-test#2": cannot contain # or spaces

4.
% oc -n test patch route/unsec-apach --type=merge --patch '{"spec": {"path": "/route-admission-test 22"}}'
The Route "unsec-apach" is invalid: spec.path: Invalid value: "/route-admission-test 22": cannot contain # or spaces

@ShudiLi
Copy link
Member

ShudiLi commented Dec 18, 2025

/label qe-approved
/verified by @ShudiLi

@openshift-ci openshift-ci bot added the qe-approved Signifies that QE has signed off on this PR label Dec 18, 2025
@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Dec 18, 2025
@openshift-ci-robot
Copy link

@ShudiLi: This PR has been marked as verified by @ShudiLi.

Details

In response to this:

/label qe-approved
/verified by @ShudiLi

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
Copy link
Contributor

openshift-ci bot commented Dec 18, 2025

@Thealisyed: 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 06c1b7b into openshift:release-4.19 Dec 18, 2025
12 checks passed
@openshift-ci-robot
Copy link

@Thealisyed: Jira Issue OCPBUGS-61662: All pull requests linked via external trackers have merged:

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

Details

In response to this:

Add route path validation to reject # or whitespace
Add ValidatePath function and integrate it with ValidateRoute
and ValidateRouteUpdate to reject routes with '#' or spaces in spec.path

Validation changes:

  • Add ValidatePath to check for # and spaces in route paths
  • Call the library-go validation and add additional path validation

This ensures our PR matches the validation logic introduced
in https://github.com/openshift/library-go/pull/2012/files

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-merge-robot
Copy link
Contributor

Fix included in accepted release 4.19.0-0.nightly-2025-12-19-215710

@Thealisyed
Copy link
Author

/cherry-pick release-4.18

@openshift-cherrypick-robot

@Thealisyed: new pull request created: #597

Details

In response to this:

/cherry-pick release-4.18

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.

Thealisyed added a commit to Thealisyed/openshift-apiserver that referenced this pull request Feb 11, 2026
Add TestValidateRoute and TestValidateRouteUpdate tests to verify
that routes with '#' or whitespace in spec.path are rejected.
Tests copied from openshift#576
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. backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. jira/severity-important Referenced Jira bug's severity is important 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. qe-approved Signifies that QE has signed off on this PR verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants