istio: Traffic is not dropped when VS HTTPMatch is not matched by port

Is this the right place to submit this?

  • This is not a security vulnerability or a crashing bug
  • This is not a question about how to use Istio

Bug Description

In this case, curl -H "Host:any.bookinfo.com" http://1.1.1.1:80 gets ratings workload, which should be dropped according to doc and https://github.com/istio/istio/issues/49440#issuecomment-1954058003.

More interestingly, if I change vs-1’s HTTPMATCH to exact: /ratings, the same curl gets a 404 error rather than successfully gets ratings workload. Is there any differences between uri and port? IMO, just on the perspective of users, both of them should have the same behavior.

Thank you!

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: vs-1
spec:
  hosts:
  - '*.bookinfo.com'
  gateways:
  - mesh
  http:
  - match:
    - port: 9080
    route:
    - destination:
        host: delegate-2
---
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: se-0
spec:
  hosts:
  - '*.bookinfo.com'
  ports:
  - number: 80
    protocol: HTTP
    name: port-1
    targetPort: 9080
  resolution: STATIC
  workloadSelector:
    labels:
      app: ratings

Version

$ istioctl version
client version: 1.20.0
control plane version: 1.20.0
data plane version: 1.20.0 (2 proxies)
$ kubectl version --short
Client Version: v1.28.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.27.3

Additional Information

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

if you look carefully the service port defined in SE is 80, but the match port defined in vs is 9080, so the HTTP route does not match the service, so they donot match