Skip to content
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

feature: activate PKCE by default in requests to external OIDC providers #2448

Merged
merged 6 commits into from
Sep 12, 2023

Conversation

strehle
Copy link
Member

@strehle strehle commented Aug 19, 2023

PKCE for OIDC/OPENID clients is available now since years in UAA but currently only on/active for public usage Add now an own option to have it on also for all other authentications. Default on, but if a client does not want it, you can switch it off. See https://oauth.net/2/pkce/,
PKCE is not only for public usages but it is part of standard frameworks (spring and golang)

https://oauth.net/2.1/

PKCE for OIDC/OPENID clients is available now since years in UAA but currently only on/active for public usage
Add now an own option to have it on also for all other authentications. Default on, but if a client does not want it, you can switch it off.
See https://oauth.net/2/pkce/, PKCE is not only for public but it is use in this scenarios it most frameworks (spring and golang)

https://oauth.net/2.1/
@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/185865696

The labels on this github issue will be updated when the story is started.

@strehle strehle changed the title feature: Activate PKCE by default in OIDC client request feature: activate PKCE by default in OIDC client request Aug 21, 2023
@strehle
Copy link
Member Author

strehle commented Aug 26, 2023

@peterhaochen47 this belongs to PKCE story, similar to cloudfoundry/cf-uaa-lib#90 , because it is PKCE as client

@peterhaochen47 peterhaochen47 added the in_review The PR is currently in review label Aug 29, 2023
@peterhaochen47
Copy link
Member

peterhaochen47 commented Aug 29, 2023

To clarify, this PR is only about when UAA is acting as an OAuth client, authenticating with an external OAuth server (as opposed to UAA clients authenticating with UAA), correct? In that case, if the external OAuth server does NOT support PKCE, would this be a breaking change?

Also, when an external OAuth server does not support PKCE, would it just ignore the code_verifier & code_challenge and still issue the token/code, or would it fail the auth request?

@strehle
Copy link
Member Author

strehle commented Sep 8, 2023

To clarify, this PR is only about when UAA is acting as an OAuth client, authenticating with an external OAuth server (as opposed to UAA clients authenticating with UAA), correct? In that case, if the external OAuth server does NOT support PKCE, would this be a breaking change?

not if the external OIDC provider is standard complaint and even with old UAA I could not find an issue. The parameters should be ignored, if the server does not support it.

Also, when an external OAuth server does not support PKCE, would it just ignore the code_verifier & code_challenge and still issue the token/code, or would it fail the auth request?

Ignore it.

PKCE was designed to be downwards compatible and it only works if both parties support it.
UAA uses PKCE already if you have public usages, and this experience showed that we can add it also for other usages, so from my side I dont see a breaking change,
If you have a veto here, we can move to false as default, e.g. private boolean pkce = false;
But we should allow the PKCE usage also in combination of authenticated clients,

@peterhaochen47 peterhaochen47 changed the title feature: activate PKCE by default in OIDC client request feature: activate PKCE by default in requests to external OIDC providers Sep 11, 2023
@peterhaochen47
Copy link
Member

peterhaochen47 commented Sep 11, 2023

@strehle I see, thank you. I tried to edit the PR title to clarify what this feature is.

My question is similar to this one about cf-uaac:
If, as you said, the PKCE is fully backward compatible (both clients and auth-server have to support it for it to take effect; and the auth request will not fail if one of them does not support it), then what is the purpose of adding the config config.pkce from the user perspective? Why not just always try to use PKCE?

@strehle
Copy link
Member Author

strehle commented Sep 12, 2023

@strehle I see, thank you. I tried to edit the PR title to clarify what this feature is.

My question is similar to this one about cf-uaac: If, as you said, the PKCE is fully backward compatible (both clients and auth-server have to support it for it to take effect; and the auth request will not fail if one of them does not support it), then what is the purpose of adding the config config.pkce from the user perspective? Why not just always try to use PKCE?

in UAAC I am with you to enable PKCE always because uaac is for UAA only and here I can say it works. Therefore changed cloudfoundry/cf-uaac#123 to use always PKCE.

The OIDC flow is for other OIDC providers and there it might be not safe even if they should be compatible.
The new options is on by default, but if somebody see an error, then PKCE could be deactivated again. Simply because I dont know which OIDC provder is used I would go with this option, what do you think?

@peterhaochen47
Copy link
Member

peterhaochen47 commented Sep 12, 2023

I see. My concern is that removing an added config is a lot of work (you have to deprecate it, and advance major version, etc.).
But if you believe that there're some unknown risks (even though theoretically there shouldn't be) then adding an option is fine. Your call!

@strehle strehle added this to the 76.21.0 milestone Sep 12, 2023
@strehle strehle merged commit db28275 into develop Sep 12, 2023
18 checks passed
@strehle strehle deleted the feature/oidc-idp-with-pkce branch September 12, 2023 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in_review The PR is currently in review
Projects
Development

Successfully merging this pull request may close these issues.

3 participants