istio: JWT metadata broken in Envoyfilter since 1.21.0

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

Attempted to update to 1.21 today; and our envoyfilter which extracts JWT metadata is failing, specifically we do this:

local meta = request_handle:streamInfo():dynamicMetadata():get("envoy.filters.http.jwt_authn")
local claims = meta["https://app.platform-identity-provider.testing.k8.atcloud.io"]

In this case, claims is empty, whereas on 1.20 is was correctly populated.

We have the following RequestAuthentication filter:

apiVersion: security.istio.io/v1
kind: RequestAuthentication
metadata:
  name: request-authentication
  namespace: istio-system
spec:
  jwtRules:
  - audiences:
    - delivery-platform-testing
    forwardOriginalToken: true
    fromHeaders:
    - name: authorization
      prefix: 'Jwt '
    issuer: https://app.platform-identity-provider.testing.k8.atcloud.io
    jwksUri: http://app.platform-identity-provider.svc.cluster.local/jwks

Version

1.21.0

Additional Information

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 24 (19 by maintainers)

Most upvoted comments

This is a pretty huge change for us to consume (in terms of # of affected AuthorizationPolicy files).

Just to confirm, is #49913 is contributing to the above? My interpretation of @kyessenov comment above is that requestPrincipal is parsing out issuer and subject and then comparing both to the values provided in the JWT. Once that issue is fixed (which was possibly in #50061), will there still be changes that need to be made to policies that are using a value other than * for the requestPrincipal field? Having to set a * in all cases seems like that field is broken.

For context, we’re testing requestPrincipal in our policies today and our subject doesn’t contain slashes – actually we’re using “*” for subject in the requestPrincipals (e.g. https://my.issuer/*), but don’t specifically test [iss] or [sub] today. In 1.21.2 tests using a * for requestPrincipal and then specifically testing [iss] (set to https://myissuer in the when section) seems to result in success, but would like to avoid rolling that change if at all possible.

@kyessenov I believe there should be at least a change note for reference after such critical change? I don’t think changing payload structure is a “small” change that can ignore and no user receive any official notice while upgrade.

Not sure if I fully understand, @kyessenov is this a regression? Should it be fixed? If not, would it be best to deprecate requestPrincipals and request.auth.principal or at least update the documentation, discouraging using anything but * and using request.auth.claims[iss] + request.auth.claims[sub]?

Now the key is always “payload” since it simplifies the configuration.

Agree, it’s simpler.

but we usually reserve the right to do small changes like this

That’s why I suggested it might simply be a release note thing. I’m willing to bet I’m not the only user reading jwt claims in a lua envoyfilter?

@kyessenov I’m not sure I understand you, we have a perfectly working envoyfilter on 1.20; which has the claims under request_handle:streamInfo():dynamicMetadata():get("envoy.filters.http.jwt_authn")["https://app.platform-identity-provider.testing.k8.atcloud.io"]; which no longer works, but request_handle:streamInfo():dynamicMetadata():get("envoy.filters.http.jwt_authn")["payload"] does.