Closed sschepens closed 11 months ago
We are suffering exactly the same issue (even CORS handled by our backend, not VirtualService). I am using 1.18.0 version of Istio.
To make it works, I had to add additional rule to the AuthorizationPolicy
:
apiVersion: security.istio.io/v1beta1
kind: AuthorizationPolicy
metadata:
name: validate-jwt
namespace: istio-system
spec:
action: ALLOW
selector:
matchLabels:
istio: ingress
rules:
...
# Disable JWT validation for preflight requests
- to:
- operation:
hosts:
- MY_HOST
methods:
- OPTIONS
...
The rule is disabling JWT validation for all OPTIONS requests, which is not ideal.
Can we change the order of the http filters as requested by the author?
cc @kyessenov
🚧 This issue or pull request has been closed due to not having had activity from an Istio team member since 2023-08-14. If you feel this issue or pull request deserves attention, please reopen the issue. Please see this wiki page for more information. Thank you for your contributions.
Created by the issue and PR lifecycle manager.
@kyessenov should we keep this open or is #47551 enough?
Any chances to get this issue reopened?
Is this the right place to submit this?
Bug Description
One cannot correctly Authorize CORS Preflight Requests when using JWT Tokens.
This happens because Istio is currently enabling
bypass_cors_preflight
as per this issue.The problem is that
bypass_cors_preflight
skips all of the processing done byjwt_authn
filter an so does not provide metadata information forRBAC
to use.In our case we have our traffic using JWT tokens and we need to authorize requests with information in those tokens and we cannot do so for Preflight Requests because they contain no information, so we end up rejecting those requests. We could of course allow all Preflight Requests without authentication info but that is less than ideal.
We also cannot disable
bypass_cors_preflight
with anEnvoyFilter
, my theory is that this is because it's a protobuf native boolean field it's default value isfalse
, so when we attempt to set that, Istio only sees an empty proto (it cannot distinguish if it's been explicitly set to false).My question is why do we need to enable this flag and why don't we instead put
CORS
filter beforeJWT
since that was what was originally requested.@howardjohn @yangminzhu
EDIT: clarification, we're not using VirtualService CorsPolicy, instead, currently, CORS is being handled directly by our applications
Version
Additional Information
No response
Affected product area