oauth2-proxy: Client secret is not required for OIDC with PKCE enabled
First off, thanks for the great project!
Expected Behavior
I have configured oauth2-proxy with Okta and configured the Okta app to be a public client using PKCE and in this case there is no client secret provided by Okta. It would be great to be able to start oauth2-proxy without a client secret because it works perfectly with PKCE if you are able to work around not supplying the client secret.
Current Behavior
The startup validation checks that client secret is provided unless the provider is login.gov:
However, I’ve found that it’s possible to work around this by supplying an empty client secret file via the client-secret-file argument.
Possible Solution
Perhaps a special value of ‘none’ would skip validation - or maybe tie it to the code challenge type parameter being set (although presumably some OIDC providers do provide a client secret when using pkce?)
Steps to Reproduce (for bugs)
Start oauth2 proxy without a client secret supplied, startup will error.
- Set client secret to an empty string
- Set other params to use Okta OIDC with PKCE enabled
image:
tag: v7.3.0
config:
clientID: blahblahblah
clientSecret: ""
cookieSecret: blahblahblahblahblah
extraArgs:
provider: oidc
redirect-url: /oauth2/callback
oidc-issuer-url: https://somedomain.oktapreview.com/oauth2/default
code-challenge-method: S256
email-domain: "*"
skip-provider-button: true
set-authorization-header: true
set-xauthrequest: true
scope: openid profile email groups
- Start oauth2-proxy
Context
Trying to use oauth2-proxy with Okta PKCE as per (this)[https://developer.okta.com/blog/2019/08/22/okta-authjs-pkce] article.
Your Environment
- Version used:
7.3.0
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 8
- Comments: 19 (8 by maintainers)
Commits related to this issue
- Added support for public clients Adds support for public clients #1714 — committed to jrote1/oauth2-proxy by jrote1 4 years ago
- Added support for public clients Adds support for public clients #1714 — committed to jrote1/oauth2-proxy by jrote1 4 years ago
Even in 2023, it still is relevant.
still relevant
Hello,
First of all, I would like to express my deepest gratitude to everyone involved in building and improving OAuth2 Proxy, such a great solution.
I have encountered the same issue described in this thread when using Entra ID, so I’d like to share my findings.
When authenticating with Entra ID and OIDC, it is typically treated as a confidential client, requiring either a client secret or a certificate. However, it is also possible to configure it as a public client, in which case authentication can be implemented without a client secret. While omitting the client secret may introduce security vulnerabilities, Entra ID recommends using PKCE (Proof Key for Code Exchange) to enhance security.
I understand from the earlier discussion that PKCE can be used even when a client secret is present to ensure security. However, I would like to propose the following enhancements:
Would you consider these changes? If it’s better to create a separate issue for this proposal, please let me know.
Looking forward to your response.
We had the same issue as well, and workaround to set the secret file to an empty file worked. Setting the secret file to
/dev/nullworks as well, which could save some time not having to add an extra mount with an empty file or an empty configmap.Looking at a fix for this, could we have a flag like
--client-secret-allow-emptythat skips this validation block, so that it is still backward compatible and gives the user the option to ignore it where appropriate.It still is.