-
Notifications
You must be signed in to change notification settings - Fork 392
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
Filters for OIDC authentication mechanisms #2496
Comments
@arkodg any comments to this one? As I see this is quite important feature to have possibility to use service with human users and machines. |
@zetaab @sadovnikov my hesitance is with including another field like You could implement the same logic (#2425 (reply in thread)) with 2 HTTPRoutes today
This should unblock you for now, but will end up causing some duplicate configuration for you. You could also use a EnvoyPatchPolicy with a A more long term would be to to figure out the right UX / field for this use case. |
@arkodg From my discussion with @zhaohuabing I understood that two HTTP Routes cannot be applied to the same host/path. It seems I read it wrong, it's just necessary to ensure the uniqueness of the "matches" in the routes. We'll give it a try |
This issue has been automatically marked as stale because it has not had activity in the last 30 days. |
here is the example of how it can be used currently https://gist.github.com/zetaab/31b835bfed5bdc7b2a3e29bc6557e3c1 What that does?
However, if its used like this it means that application should have the logic to redirect to /login when its needed to use refresh token / create new token. tl;dr it works but its not pretty |
This issue has been automatically marked as stale because it has not had activity in the last 30 days. |
rethinking this one, if we add introduce a field - |
Yeah, this sounds reasonable to me. I'll raise an issue in Envoy and try to support this in v1.3.0. |
@zhaohuabing envoy already supports this as highlighted in #2496 (comment) An API field is needed in EG that solves the use case |
This issue has been automatically marked as stale because it has not had activity in the last 30 days. |
It looks like the I've tried the following patch and it appears to be working.
I guess the fix for this issue is to change the xds translator so that if jwt auth is also specified in the gateway CRD then
Edit: scratch that last bit about basic auth... clearly not going to work |
hey @StephenRobin thanks for driving this work |
Hi @arkodg, I'm not so sure that a new field makes sense. This was my thinking:
Therefore it made more sense to just automatically allow oidc bypass when jwt is also enabled. Thinking about it again, this might be the wrong behaviour if they had either changed the order of the filters, or if they were using the extractFrom feature in JWT. |
Thanks for thinking this through @StephenRobin
There may be a case, when a user may want to force OIDC Auth. @missBerg @zhaohuabing @denniskniep probably have a better understanding of the spec, but I think there's a chance we may want to implicitly add JWT validation in the future if the spec clearly mentions it, this would mean that a separate JWT instantiation is not required.
yes, this is something that can be flagged with a bad status
It pertains to skipping OIDC Auth, so imo should live in OIDC.
We can make this intelligent and peek into |
My thoughts on that:
https://gateway.envoyproxy.io/docs/api/extension_types/#jwtprovider That means, that
We do have a case where there is an application specific Authorization Header set which has nothing to do with the OIDC/JWT Filter. Therefore the two proposed fields ( Would make sense to define good conditional defaults if it´s not explicitly specified i.e.
|
thanks @denniskniep |
How about keeping this simple for now, just satisfy the known problems people have actually asked us to resolve:
These criteria will, I believe, ensure we're not breaking or changing the behaviour of existing SecurityPolicy's that people may be running. I'd be particularly concerned about defaulting passThroughAuthHeaders to true if jwt is present, potentially leaving user's configurations insecure if they have some set-up we've not thought of. These criteria should also make it hard for someone to misconfigure the SecurityPolicy in an insecure way. I chose the naming to be consistent with the naming of the underlying passThroughMatcher in xDS. I think this leaves us open to future changes, including those suggested above:
I hope this strikes a reasonable balance between the concerns. Thoughts? |
What about making it so that the OIDC filter only does anything if there is no token in the Authorization header? If a request comes in with a token in the Authorization header it should indicate no OIDC should happen. |
Hi @missBerg
This is exactly what we're proposing. Envoy itself has a passthroughMatcher option, this can be configured so that if a request comes in with the header "Authorization: Bearer ...." then OIDC does nothing and passes to the next filter for JWT checks. We propose adding a new option that switches this on (as users may not always want it) and also making it an error to specify this new option when JWT is switched off or not configured to read that header. |
hey @StephenRobin your proposal looks good |
That would break our setup. We do have an application which does some app specific stuff with the Authorization-Header. But regardless what the app is doing with the Authorization-Header we want to authenticate with OIDC Filter and use the JWT Filter to extract the idtoken from the cookie and do authorization decisions. |
Hi @denniskniep, as I said above, the behaviour will be unchanged unless the new |
@StephenRobin you are right, it will not break if I do not use the new But if I want to use the new option, then it breaks, because the auth header is already used differently by the upstream. |
So @denniskniep you're referring to a case where multiple auth tokens exist ? |
exactly, one which is controlled by the upstream app (I have no control over this) and the upstream app is using the Authorization header for this. And another one which is then used for envoy auth inside jwt filter. Because Authorization header is already used, it should be possible to specify an alternative header |
I think thats fine @denniskniep , this is my assumption of the API, please keep me honest here @StephenRobin
|
We probably don't want to skip oidc filter if the cookie, which was issued by the oidc filter, is in the extractFrom of the jwt filter, right? |
Ok. That makes sense. One alternative to consider is just exposing the full pass_through_matcher of Envoy, giving the user complete control. I think Envoy doesn't support pass through based on params, and I agree with @denniskniep that cookies could be problematic, so I think it should just I'm going to code this now, seems like a good Friday afternoon task. I can always change it later. |
Implemented in #5142 |
Description:
Currently, when OIDC and JWT authentication mechanisms are configured in the same
SecurityPolicy
, the OIDC is applied first. It ensures the presence of the bearer and refresh tokens in cookies, and adds theAuthorisation
header to the request. Then JWT is applied, validating the added header.This setup works perfectly for browser requests. However, it prevents monitoring systems and regression tests, which provide a valid
Authorisation
header in the requests, from accessing the services on the same URLs. The OIDC mechanism kicks in first and redirects the requests to the login pages because of the missing cookies.We suggest extending the configuration of, at least, the OIDC mechanism with the possibility of adding a header-based filter.
When implemented, the OIDC can be skipped if the
Authorization
header is present.An example of the configuration:
Envoy Proxy supports Composite Filters, which support such decisions and therefore can be used to implement this functionality.
Relevant Links:
The text was updated successfully, but these errors were encountered: