Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual Server validation does not reject regex subroute paths that do not match virtual server path #4727

Closed
Tracked by #4998
haywoodsh opened this issue Nov 30, 2023 · 1 comment · Fixed by #4744
Assignees
Labels
backlog Pull requests/issues that are backlog items bug An issue reporting a potential bug
Milestone

Comments

@haywoodsh
Copy link
Contributor

haywoodsh commented Nov 30, 2023

Describe the bug

In virtual server validation, if a virtual server route does not have the virtual server path as prefix, it will be rejected. In the specific where the subroute is a regex path, however, the validation fails to reject an invalid virtual server route definition, where a subroute path does not have the virtual server path as prefix.

To Reproduce
Steps to reproduce the behavior:
deploy the following virtual server and virtual server route:
Virtual server path:

- path: /team1/map/
  route: team1/map-ingress

virtual server route:

spec:
  host: xyz-x.fqdn
  upstreams:
    - name: map-svc
      service map-svc
      port: 80
  subroutes:
  - path: ~*^/map(/|$)(.*)
    action:
      proxy:
        upstream: map-svc
        rewritePath: /$2

Expected behavior
The virtual server route with incorrect subroute path should be rejected during validation

Additional context
This could be the possible code snippet that should return an error message but does not.
https://github.com/nginxinc/kubernetes-ingress/blob/main/pkg/apis/configuration/validation/virtualserver.go#L1482-L1485

Copy link

Hi @haywoodsh thanks for reporting!

Be sure to check out the docs and the Contributing Guidelines while you wait for a human to take a look at this 🙂

Cheers!

@haywoodsh haywoodsh changed the title Virtual Server routes Virtual Server validation does not reject subroute path with regex that do not match virtual server path Nov 30, 2023
@haywoodsh haywoodsh changed the title Virtual Server validation does not reject subroute path with regex that do not match virtual server path Virtual Server validation does not reject regex subroute paths that do not match virtual server path Nov 30, 2023
@brianehlert brianehlert added bug An issue reporting a potential bug backlog Pull requests/issues that are backlog items labels Nov 30, 2023
@brianehlert brianehlert linked a pull request Dec 4, 2023 that will close this issue
6 tasks
@brianehlert brianehlert added this to the v3.5.0 milestone Dec 9, 2023
@danielnginx danielnginx modified the milestones: v3.5.0, v3.4.3 Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Pull requests/issues that are backlog items bug An issue reporting a potential bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants