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

Incorrect comment in code. #7992

Closed
mortenbekditlevsen opened this issue Apr 28, 2021 · 7 comments
Closed

Incorrect comment in code. #7992

mortenbekditlevsen opened this issue Apr 28, 2021 · 7 comments
Assignees

Comments

@mortenbekditlevsen
Copy link
Contributor

The comment on the referred line specifies that the order of supportedAuthDomains matters. But the outer loop is the authorized domains from the web request, so actually the first match in the authorized domains list 'wins'.
The inner and outer loops should be switched for the comment to be correct.

// The sequence of supportedAuthDomains matters. ("firebaseapp.com", "web.app")

@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@mortenbekditlevsen
Copy link
Contributor Author

Just to make my initial comment a bit clearer:

Currently, the supportedAuthDomains order does not matter (as opposed to what's stated in the comment) - the returned domain will be determined by the order of response.authorizedDomains.

If response.authorizedDomains contains ["my.web.app", "my.firebaseapp.com"], then we would first look to see if my.web.app matched any of ["firebaseapp.com", "web.app"], which it does and then "my.web.app" will be used.

If the response order was different: ["my.firebaseapp.com", "my.web.app"], then the first match would be for my.firebaseapp.com.

And thus, contrary to the comment, it's not the order of supportedAuthDomains that matters, but the order of response.authorizedDomains that matters. And the latter is not controlled by the library, so that seems like an error - if indeed the order of supportedAuthDomains matters.

@paulb777
Copy link
Member

@rosalyntan Should the comment be fixed or the code updated to match the comment?

cc: @renkelvin

@paulb777 paulb777 added this to the Firebase 11 milestone May 28, 2023
@renkelvin
Copy link
Contributor

I think we should update the code to match the comment.

@paulb777 paulb777 assigned paulb777 and unassigned rosalyntan May 29, 2024
@paulb777
Copy link
Member

The code is updated in the release-11.0 branch: https://github.com/firebase/firebase-ios-sdk/blob/release-11.0/FirebaseAuth/Sources/Swift/Utilities/AuthWebUtils.swift#L117

@mortenbekditlevsen
Copy link
Contributor Author

Well, on line 130 and 131 the iteration of supportedAuthDomains is still nested in the iteration of the response domains, so the order or supportedAuthDomains still doesn't matter, does it?

@paulb777
Copy link
Member

Oops. Good catch, Morten! I'll reopen the issue and send a PR.

@paulb777 paulb777 reopened this May 30, 2024
@firebase firebase locked and limited conversation to collaborators Jul 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants