You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "mc-round2 (via GitHub)" <gi...@apache.org> on 2024/03/08 14:43:47 UTC
[I] Unable to validate audience claim using openid-connect [apisix]
mc-round2 opened a new issue, #11018:
URL: https://github.com/apache/apisix/issues/11018
### Description
Hi,
Im trying to use OIDC to authenticate my APIs, so far its working but its working a bit too well because every single token can pass as long as it is a valid token.
Im trying to only allow tokens that were created for the specific API that im trying to connect to be allowed, and tokens that are valid BUT *not for this specific API* to be unauthorized.
My token provider provides the audience claim that ideally should be cross referenced with the client_id of the route. From my understanding of the documentation (and according to the APISIX DOCS AI) this should come out of the box... but it clearly doesnt.
Am I missing something?
This is the current config that I have for the openid-connect plugin:
`bearer_only: true
client_id: wtv
client_secret: wtvwtvw
discovery: https://auth.wtv.wtv/auth/realms/wtv/.well-known/openid-configuration
introspection_endpoint: https://auth.wtv.wtv/auth/realms/wtv/protocol/openid-connect/token/introspect
introspection_endpoint_auth_method: client_secret_basic
use_jwks: true`
### Environment
- APISIX version (run `apisix version`):
- Operating system (run `uname -a`):
- OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
- etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`):
- APISIX Dashboard version, if relevant:
- Plugin runner version, for issues related to plugin runners:
- LuaRocks version, for installation issues (run `luarocks --version`):
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Unable to validate audience claim using openid-connect [apisix]
Posted by "mc-round2 (via GitHub)" <gi...@apache.org>.
mc-round2 commented on issue #11018:
URL: https://github.com/apache/apisix/issues/11018#issuecomment-1988006124
There is no relevant logs no.
I find it weird that the feature is not supported though... shouldn't this be a basic feature for an API Gateway? What is the point of having a token and not being able to verify that it is the correct one for the API that is trying to connect? I could find in other plugins the mention for the audience claim, so it is not unthought of.
I tried before quite a few combinations using scopes and required_scopes but Im not sure Im understanding how to use them well enough (or if it is related to begin with)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Unable to validate audience claim using openid-connect [apisix]
Posted by "Revolyssup (via GitHub)" <gi...@apache.org>.
Revolyssup commented on issue #11018:
URL: https://github.com/apache/apisix/issues/11018#issuecomment-2750499959
@dtsek @mc-round2 The audience claim validation is now supported
https://github.com/apache/apisix/pull/11987
You can reopen if you have any issues.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Unable to validate audience claim using openid-connect [apisix]
Posted by "njanelt (via GitHub)" <gi...@apache.org>.
njanelt commented on issue #11018:
URL: https://github.com/apache/apisix/issues/11018#issuecomment-1997309279
Did you try to leave the client_secret parameter unfilled? So just leave it as <"client_secret": "",>. As you use a bearer to authenticate there shoudn't be a need to provide the secret. Maybe the plugin just uses credentials grant instead if the bearer auth is unsuccessful.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Unable to validate audience claim using openid-connect [apisix]
Posted by "njanelt (via GitHub)" <gi...@apache.org>.
njanelt commented on issue #11018:
URL: https://github.com/apache/apisix/issues/11018#issuecomment-2017679563
> Hello, we are facing the same issue (not being able to validate the aud claim). Just to recap:
>
> We are using the openid-connect with the following parameters configured:
>
> * `discovery` with the `.well-known/openid-configuration` endpoint
> * `client_id`
> * `client_secret`
> * `bearer_only` set to `true`
> * `introspection_endpoint` with the `openid-connect/token/introspect` endpoint
> * `use_jwks` set to true, otherwise everything fails with 401
>
> Alternative of the last two, is to set the public key instead.
>
> I expect openid-connect to allow Bearer tokens that are created with the provided `client_id` and `client_secret` but instead, all valid tokens even from other clients are allowed.
>
> If this is true and this is the intended behaviour, it sounds like a quite serious security issue imo. Can you confirm that this is the result of your tests too? Is there any other similar plugin that offers this functionality?
>
> Is this something you can verify @shreemaan-abhishek ?
Yes I am facing the same issue. @shreemaan-abhishek is this rellay the intended behaviour? I think for the most usecases this plugin is not usable if it behaves like that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Unable to validate audience claim using openid-connect [apisix]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #11018:
URL: https://github.com/apache/apisix/issues/11018#issuecomment-2713474162
This issue has been marked as stale due to 350 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Unable to validate audience claim using openid-connect [apisix]
Posted by "njanelt (via GitHub)" <gi...@apache.org>.
njanelt commented on issue #11018:
URL: https://github.com/apache/apisix/issues/11018#issuecomment-2003612335
Yes you do need to provide the client secret, just leave it empty.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Unable to validate audience claim using openid-connect [apisix]
Posted by "shreemaan-abhishek (via GitHub)" <gi...@apache.org>.
shreemaan-abhishek commented on issue #11018:
URL: https://github.com/apache/apisix/issues/11018#issuecomment-1987625298
It's a bit difficult to locate this problem for me, but did you find any relevant logs? It might be the case that this feature is not supported at all.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Unable to validate audience claim using openid-connect [apisix]
Posted by "mc-round2 (via GitHub)" <gi...@apache.org>.
mc-round2 commented on issue #11018:
URL: https://github.com/apache/apisix/issues/11018#issuecomment-1997428905
> Did you try to leave the client_secret parameter unfilled? So just leave it as <"client_secret": "",>. As you use a bearer to authenticate there shoudn't be a need to provide the secret. Maybe the plugin just uses credentials grant instead if the bearer auth is unsuccessful.
If I do this, I get an error message (when using the Dashboard):
```
Invalid plugin data
should have required property 'client_secret'
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Unable to validate audience claim using openid-connect [apisix]
Posted by "njanelt (via GitHub)" <gi...@apache.org>.
njanelt commented on issue #11018:
URL: https://github.com/apache/apisix/issues/11018#issuecomment-2003833622
Ok, sorry then i do not have any further idea. Beside the issue here, I am also currently struggling with the openid-connect plugin. Unfortunately it seems to be that there is no possibility to validate an Audience Claim from Azure AD with APISIX yet. At least I didn't found any.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Unable to validate audience claim using openid-connect [apisix]
Posted by "dtsek (via GitHub)" <gi...@apache.org>.
dtsek commented on issue #11018:
URL: https://github.com/apache/apisix/issues/11018#issuecomment-2003864226
Hello, we are facing the same issue (not being able to validate the aud claim). Just to recap:
We are using the openid-connect with the following parameters configured:
- `discovery` with the `.well-known/openid-configuration` endpoint
- `client_id`
- `client_secret`
- `bearer_only` set to `true`
- `introspection_endpoint` with the `openid-connect/token/introspect` endpoint
- `use_jwks` set to true, otherwise everything fails with 401
Alternative of the last two, is to set the public key instead.
I expect openid-connect to allow Bearer tokens that are created with the provided `client_id` and `client_secret` but instead, all valid tokens even from other clients are allowed.
If this is true and this is the intended behaviour, it sounds like a quite serious security issue imo. Can you confirm that this is the result of your tests too?
Is there any other similar plugin that offers this functionality?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Unable to validate audience claim using openid-connect [apisix]
Posted by "Revolyssup (via GitHub)" <gi...@apache.org>.
Revolyssup closed issue #11018: Unable to validate audience claim using openid-connect
URL: https://github.com/apache/apisix/issues/11018
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Unable to validate audience claim using openid-connect [apisix]
Posted by "dtsek (via GitHub)" <gi...@apache.org>.
dtsek commented on issue #11018:
URL: https://github.com/apache/apisix/issues/11018#issuecomment-2006268040
After some deeper digging, it seems that indeed the audience claim is not validated against the client_id. I added a small enhancement in the PR above.
I tried the code in our instance and it is working correctly. We currently add it as a custom plugin with the documentation provided in https://apisix.apache.org/docs/ingress-controller/next/tutorials/using-custom-plugins/
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Unable to validate audience claim using openid-connect [apisix]
Posted by "mc-round2 (via GitHub)" <gi...@apache.org>.
mc-round2 commented on issue #11018:
URL: https://github.com/apache/apisix/issues/11018#issuecomment-2003744497
> Yes you do need to provide the client secret, just leave it empty.
Unfortunately it still allows every valid token (but not for the correct client_id/audience) to pass
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org