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

Manual nonce generation option #244

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

toshi0383
Copy link

Fixes: #135
Also partly fixes: #28

@google-cla
Copy link

google-cla bot commented Oct 27, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@toshi0383
Copy link
Author

@jsamol Could you sign the CLA? I cherry-picked your commit from this repository.

@jsamol
Copy link

jsamol commented Oct 27, 2022

@toshi0383 done

@theniceboy
Copy link

@toshi0383 Any updates on this?

@toshi0383
Copy link
Author

Oh I should resolve conflict. Will do. Thanks for the heads-up!

@toshi0383
Copy link
Author

Fixed conflict. Confirmed that build succeeds.
Could somebody please give a proper review for this? Maybe @petea ?

@theniceboy
Copy link

Will this be unblocking the progress on implementing native sign in (#5)?

Thanks!

@ellmaki
Copy link

ellmaki commented Apr 24, 2023

@toshi0383 @petea any chance this could be prioritized?

@toshi0383
Copy link
Author

@petea Any change merging this?
Let me know if any further action required.

@ellmaki
Copy link

ellmaki commented Apr 29, 2023

@petea bump

@gregorym
Copy link

gregorym commented May 1, 2023

@toshi0383, @ch40w31 any chance someone can take a look? it's blocking supabase/supabase-flutter#5

@toshi0383
Copy link
Author

Please do not mention to me. I don't have permission to merge in this repository.

@ellmaki
Copy link

ellmaki commented May 5, 2023

@ch40w31 or @mdmathias would either of you be willing to review this?

@mdmathias
Copy link
Collaborator

Apologies for the delay and thanks for the PR!

I added a comment to the issue with a request for a little more information. In principle, this change should be fine.

@@ -269,6 +269,7 @@ - (void)signInWithPresentingViewController:(UIViewController *)presentingViewCon
- (void)addScopes:(NSArray<NSString *> *)scopes
presentingViewController:(UIViewController *)presentingViewController
completion:(nullable GIDSignInCompletion)completion {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove space.

[GIDEMMSupport parametersWithParameters:options.extraParams
emmSupport:emmSupport
isPasscodeInfoRequired:NO]];
[GIDEMMSupport parametersWithParameters:options.extraParams
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix indentation.

#elif TARGET_OS_OSX || TARGET_OS_MACCATALYST
[additionalParameters addEntriesFromDictionary:options.extraParams];
#endif // TARGET_OS_OSX || TARGET_OS_MACCATALYST
additionalParameters[kSDKVersionLoggingParameter] = GIDVersion();
additionalParameters[kEnvironmentLoggingParameter] = GIDEnvironment();

NSString *codeVerifier = [OIDAuthorizationRequest generateCodeVerifier];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is a little tricky for me because it looks like GSI is taking on some of the implementation details within AppAuth-iOS. IIUC, we have to create codeVerifier, codeChallenge, and the nonce because we don't have an initializer that we can easily call on OIDAuthorizationRequest that takes only the nonce.

Ideally, we would have an initializer on OIDAuthorizationRequest that only adds the nonce parameter to the simplest initializer. That way, we can keep these implementation details/default values inside AppAuth.

What do you think?

@@ -674,10 +675,12 @@ - (void)testOAuthLogin_LoginHint {
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that GIDSignInTest is cluttered and that GIDSignIn is a difficult class to test (we're working on this), but could you add a test that verifies the passed in nonce is matched in the OIDAuthorizationResponse we back in GIDSignIn?

It'd be great to have a unit test that asserts: XCTAssertEqualObjects(originalNonce, authorizationResponse.request.nonce).

@ellmaki
Copy link

ellmaki commented Jun 1, 2023

@toshi0383 would you like to address these changes? I am also happy to contribute to this PR.

@toshi0383
Copy link
Author

@elliottetzkorn Sounds great! I’ve been busy lately.
Please go ahead and take over.

@ozasadnyy
Copy link

Hello @elliottetzkorn, did you have a change to take a look to this PR?

@hf
Copy link

hf commented Aug 18, 2023

Hey @elliottetzkorn, I'm on the Supabase Auth team and this fix would greatly improve the Sign in with Google experience in mobile apps while remaining as secure as the OIDC spec intends.

I would kindly ask for an expedited review.

cc @mdmathias

@singhalvipul53
Copy link

Hello,
Is there no way to add google login in react-native IOS app until google fixes the issue..??

@azlekov
Copy link

azlekov commented Sep 12, 2023

Hello,
Is there no way to add google login in react-native IOS app until google fixes the issue..??

Asking the same!

And is there any timeline where nonce support will be available?

@vonovak
Copy link

vonovak commented Sep 12, 2023

Hello, please be so kind and stop spamming the thread. Me (and others) subscribed to this thread to receive valuable updates, not questions such as "when is this going to happen" or "me too" - please be mindful of others and when asking a question, think about whether it really contributes something valuable to the discussion, thank you.

To answer the question: this is open source. A feature will be available, when someone manages to open a PR which is reviewed and merged by the maintainers. That someone could be you, or someone else (could be me, if someone hires me). Until then, there are no updates. So please either wait or write the code yourself.
Thank you for your understanding 👍 .

hf added a commit to supabase/auth that referenced this pull request Oct 16, 2023
…n ODIC flow (#1264)

It appears that in certain client libraries that deal with the OIDC
authentication flow, such as [this one for React Native on
iOS](google/GoogleSignIn-iOS#244), the clients
are unable to extract the nonce that is generated randomly by the
library.

This option allows to temporarily drop the enforcement at the GoTrue
level when performing the OIDC flow. This does remove an important
security barrier, which could potentially allow "stolen" ID tokens to be
used on third-party services (that have opted in to this configuration)
however in the interest of flexibility and broad platform support the
option is being added.
hoeseong19 pushed a commit to hoeseong19/gotrue that referenced this pull request Oct 16, 2023
…n ODIC flow (supabase#1264)

It appears that in certain client libraries that deal with the OIDC
authentication flow, such as [this one for React Native on
iOS](google/GoogleSignIn-iOS#244), the clients
are unable to extract the nonce that is generated randomly by the
library.

This option allows to temporarily drop the enforcement at the GoTrue
level when performing the OIDC flow. This does remove an important
security barrier, which could potentially allow "stolen" ID tokens to be
used on third-party services (that have opted in to this configuration)
however in the interest of flexibility and broad platform support the
option is being added.
@GhostWalker562
Copy link

Seems like custom nonce was released 3 weeks ago https://github.com/openid/AppAuth-iOS/releases/tag/1.7.0 , are we able to revisit this PR?

@vonovak
Copy link

vonovak commented Mar 29, 2024

Hello,
I'm the author of the custom nonce functionality that was merged and released in AppAuth.
I'm planning to add this feature to Google sign in SDK as well.

However, I don't have a precise timeline for this. My estimate is that I will have time to do it in 2 months. If anyone wants to support me in prioritizing it, please consider sponsoring me on GH sponsors, or get in touch.
Alternatively, someone else can do it before me, of course.

I will edit this comment once I start working on it, so that there's no duplication of effort.

@SunilKividor
Copy link

can anyone help me adding the nonce parameter in the google sign in package . I really need to send a nonce in the parameter while signing in. I am ready to fork and make changes.

@vonovak
Copy link

vonovak commented Apr 28, 2024

I have opened a PR to support this: #402

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to pass in nonce? Expose more advanced OIDAuthorizationRequest configuration options.