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

fix: allow native applications to use https:// on loopback redirect addresses #691

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

conblem
Copy link

@conblem conblem commented Dec 17, 2024

This pull request addresses an issue where native clients were unable to utilize HTTPS for redirects on loopback addresses.

Changes Made:

  • Updated the redirect validation logic to accommodate HTTPS uri's for native applications

Part of this: zitadel/zitadel#4091

if client.ApplicationType() == ApplicationTypeNative {
return validateAuthReqRedirectURINative(client, uri)
}
if strings.HasPrefix(uri, "https://") {
Copy link
Author

Choose a reason for hiding this comment

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

previously URI's like https://registered/callback got handled by this but now validateAuthReqRedirectURINative takes precedence

if err := checkURIAgainstRedirects(client, uri); err == nil {
if client.DevMode() {
return nil
}
// The RedirectURIs are only valid for native clients when localhost or non-"http://"
if !isLoopback && strings.HasPrefix(uri, "https://") {
Copy link
Author

Choose a reason for hiding this comment

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

To still support URI's like https://registered/callback this condition had to be added. Im not 100% happy with the code tho

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need to support https://registered/callback on a non-loopback address? Native clients only run on the localhost, right? I also do not see that use case in the linked issue.

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

Successfully merging this pull request may close these issues.

2 participants