You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "slawrencemd (via GitHub)" <gi...@apache.org> on 2024/04/03 18:17:25 UTC
[I] [Bug] OIDC - Optional alg field causes OIDC auth to fail [pulsar]
slawrencemd opened a new issue, #22419:
URL: https://github.com/apache/pulsar/issues/22419
### Search before asking
- [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.
### Read release policy
- [X] I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.
### Version
Pulsar v3.1.1
### Minimal reproduce step
Goal is to enable OIDC in a standalone Pulsar instance via Azure App Registrations.
1. Create an App registration in Azure in preparation for OIDC
2. Bind the necessary args to the standalone.conf file to enable OIDC following official instructions, including admin role binding
3. Start instance
4. Configure the pulsar admin/shell to use OAuth2 with a credential and make an admin call (ex: tenants list)
### What did you expect to see?
listed tenants
### What did you see instead?
A 401/unauthorized on the client/shell side.

An error on the Pulsar broker/instance side: Failed to authenticate HTTP request: `Failed to authenticate HTTP request: JWK's alg [null] does not match JWT's alg [RS256]`

### Anything else?
The 'alg' header is [optional](https://datatracker.ietf.org/doc/html/rfc7517#page-8), as per the JWK spec:

[Azure does not return this as field as part of the well known config](https://github.com/awslabs/aws-jwt-verify/issues/6), but the Pulsar [OIDC implementation](https://github.com/apache/pulsar/blob/cd6f53baee7dbe0651e6581cb9bd3570017348c7/pulsar-broker-auth-oidc/src/main/java/org/apache/pulsar/broker/authentication/oidc/AuthenticationProviderOpenID.java#L307) requires this. This validation is failing and results in the error I saw in the Pulsar instance logs:

It's also possible I've screwed up the OIDC configuration, but my suspicion above seems to make sense... I can share more of my config if needed.
I'll be glad to do anything I can to help fix this; my guess is this behavior would prevent it from functioning with Azure (if the alg field is missing globally). Short of creating a custom OIDC implementation/authorizer myself, is there anything else I can do in the interim to get around this?
### Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
--
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: commits-unsubscribe@pulsar.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] OIDC - Optional alg field being required in Pulsar causes OIDC authentication to fail [pulsar]
Posted by "slawrencemd (via GitHub)" <gi...@apache.org>.
slawrencemd commented on issue #22419:
URL: https://github.com/apache/pulsar/issues/22419#issuecomment-2035297370
Screenshot of missing 'alg' field in azure ./well-known config:

--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] OIDC - Optional alg field being required in Pulsar causes OIDC authentication to fail [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on issue #22419:
URL: https://github.com/apache/pulsar/issues/22419#issuecomment-2035373957
Thanks for the good issue report @slawrencemd ! Would you like to contribute a fix?
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] OIDC - Optional alg field being required in Pulsar causes OIDC authentication to fail [pulsar]
Posted by "michaeljmarshall (via GitHub)" <gi...@apache.org>.
michaeljmarshall commented on issue #22419:
URL: https://github.com/apache/pulsar/issues/22419#issuecomment-2036200849
Great write up, thanks for surfacing this!
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] OIDC - Optional alg field being required in Pulsar causes OIDC authentication to fail [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on issue #22419:
URL: https://github.com/apache/pulsar/issues/22419#issuecomment-2036187745
I'm working on a fix.
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] OIDC - Optional alg field being required in Pulsar causes OIDC authentication to fail [pulsar]
Posted by "slawrencemd (via GitHub)" <gi...@apache.org>.
slawrencemd commented on issue #22419:
URL: https://github.com/apache/pulsar/issues/22419#issuecomment-2037143832
You guys are fast! Thank you.
I'm still setting up my environment and getting the build up and running; once I get those first baby steps done and a bit comfier with the codebase/processes, I'll be glad to contribute in other issues/features.
thanks,
-s
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] OIDC - Optional alg field being required in Pulsar causes OIDC authentication to fail [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari closed issue #22419: [Bug] OIDC - Optional alg field being required in Pulsar causes OIDC authentication to fail
URL: https://github.com/apache/pulsar/issues/22419
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org