istio: Request Authentication ignored when using Ambient

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

Note this issue was originally reported as a security vulnerability but I was instructed by @howardjohn to open an issue here:

Hi,

Thanks for the report. Since Ambient is alpha I think this can just be opened publicly. Can you include if you have a waypoint proxy deployed in the issue?

Thanks!

I’m doing some preliminary testing with Ambient using Istio 1.18.0 and believe I’ve found a vulnerability when using a Request Authentication and an Authorization Policy. The behavior is different when compared to using the sidecar model. I’m deploying an HTTP client and server pod, then verifying they can communicate using curl. I then deploy the following Authorization Policy and Request Authentication:

apiVersion: security.istio.io/v1beta1
kind: AuthorizationPolicy
metadata:
  name: http-server
  namespace: http-server
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: http-server
  action: ALLOW
  rules:
  - from:
    - source:
        requestPrincipals: ["*"]
---
apiVersion: security.istio.io/v1beta1
kind: RequestAuthentication
metadata:
  name: http-server
  namespace: http-server
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: http-server
  jwtRules:
  - issuer: [testing@secure.istio.io](mailto:testing@secure.istio.io)
    jwksUri: https://raw.githubusercontent.com/istio/istio/master/security/tools/jwt/samples/jwks.json

At this point I would expect any requests that don’t contain a JWT, contain an invalid JWT or JWT from another issuer to be rejected. As a sanity check, I verified that using the same configuration with sidecars produces a 401/403 response.

This behavior was seen after I had a waypoint deployed. Without a waypoint, I saw Connection reset by peer as soon as the Authorization Policy was deployed.

Version

$ istioctl version
client version: 1.18.0
control plane version: 1.18.0
data plane version: 1.18.0 (8 proxies)
$ kubectl version --short
Flag --short has been deprecated, and will be removed in the future. The --short output will become the default.
Client Version: v1.27.2
Kustomize Version: v5.0.1
Server Version: v1.27.1

Additional Information

No response

Affected product area

  • Ambient
  • Docs
  • Installation
  • Networking
  • Performance and Scalability
  • Extensions and Telemetry
  • Security
  • Test and Release
  • User Experience
  • Developer Infrastructure
  • Upgrade
  • Multi Cluster
  • Virtual Machine
  • Control Plane Revisions

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (14 by maintainers)

Most upvoted comments

@myshkin5 Sorry to chase this up but I can’t seemingly get RequestAuthentication checks to work in ambient for me, no matter what I do they give me a 200 response - no header, invalid jwt, valid jwt. All pass through to the pod and responses are completed.

I appreciate it’s been a year, but if anyone has a full reproducible example I can deploy to a namespace to inspect the configuration and adapt it, I’d appreciate!

@keithmattix You are right, I did say that. Looking back at my notes, I think (not 100% sure) I was using a deny everything auth policy. Just tried recreating that original scenario and this was the only auth policy that causes a connection reset as described above:

apiVersion: security.istio.io/v1beta1
kind: AuthorizationPolicy
metadata:
  name: http-server
  namespace: http-server
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: http-server
  action: DENY
  rules:
  - from:
    - source:
        requestPrincipals: ["*"]
  - to:
    - operation:
        ports: ["8000"]

Sorry for the confusion

but the authorization policy part should right? that’s what was denying before the waypoint was added

On Fri, Jun 16, 2023, 8:19 AM Keith Mattix II @.***> wrote:

RequestAuthentication is L7 policy though; it wouldn’t apply to the ztunnel regardless…If an RA exists in an Ambient context, we know that the waypoint should process it right?

— Reply to this email directly, view it on GitHub https://github.com/istio/istio/issues/45502#issuecomment-1594861538, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEYGXPW4IKD2OEZ3Q4PS7LXLR2QTANCNFSM6AAAAAAZIOYLOY . You are receiving this because you were mentioned.Message ID: @.***>