Skip to content

Conversation

@enahum
Copy link
Contributor

@enahum enahum commented Oct 28, 2025

Summary

this PR introduces the EasyLogin for Guests accounts. This is part of the project of Build 2025

Ticket Link

TDB

Release Note

NONE

@enahum enahum requested review from devinbinnie and larkox October 28, 2025 00:23
@enahum enahum added the 2: Dev Review Requires review by a core committer label Oct 28, 2025
@enahum
Copy link
Contributor Author

enahum commented Oct 29, 2025

@devinbinnie don't know if the problem is me, but for some reason when I try to open the link after the server has been added previously, it still does not navigate properly.. I think the whole thing is strange, for example

  1. in the login screen and I open /signup_user_complete?redirect_to=something seems to be working just fine
  2. in the same login screen or even in the sign_user_complete, I open /login/sso/easy?t=xxxxxxxxx it does not seem to navigate

any idea why that would be ? I've search through the codebase to see if it was possibly related to the login path but found nothing.

@devinbinnie
Copy link
Member

@devinbinnie don't know if the problem is me, but for some reason when I try to open the link after the server has been added previously, it still does not navigate properly.. I think the whole thing is strange, for example

1. in the login screen and I open `/signup_user_complete?redirect_to=something` seems to be working just fine

2. in the same login screen or even in the sign_user_complete, I open `/login/sso/easy?t=xxxxxxxxx` it does not seem to navigate

any idea why that would be ? I've search through the codebase to see if it was possibly related to the login path but found nothing.

@enahum Seems to be working okay for me - I can open the link from a browser and the URL in the tab changes.

@enahum
Copy link
Contributor Author

enahum commented Nov 12, 2025

During our convo we found that the webapp may be blocking the request to the server if the path contains login and we would need to add a special case.

@devinbinnie can you expand a bit more, I don't remember the details

@amyblais amyblais added this to the v6.1.0 milestone Dec 18, 2025
@larkox
Copy link
Contributor

larkox commented Dec 18, 2025

@devinbinnie Added the changes to open the login screen properly even if the server is already added.

const parsedURL = parseURL(url)!;
const server = ServerManager.lookupServerByURL(parsedURL, true);

let trimmedPathname = getFormattedPathName(parsedURL.pathname);
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is necessary, getFormattedPathName basically just adds a / to the end of the pathname:

export const getFormattedPathName = (pn: string) => (pn.endsWith('/') ? pn : `${pn}/`);

So if we want to remove it, we should just use parsedURL.pathname

}

// Also allow for URLs where /login/sso/easy is not at root (e.g., subpath)
const match = url.match(/\/login\/sso\/easy\?t=([A-Za-z0-9]{64})/);
Copy link
Member

Choose a reason for hiding this comment

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

We should avoid a regex here, they are susceptible to path traversal. Instead, we should use the isUrlType function above and match on that. It's been reviewed by security so it should be safe :)

const parsed = parseURL(urlToTest);

// Check pathname and search params
if (parsed?.pathname === '/login/one_time_link') {
Copy link
Member

Choose a reason for hiding this comment

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

This should also use isUrlType. We should also check for subpath on this one too.

}
} else if (ServerManager.hasServers()) {
ServerHub.showNewServerModal(`${parsedURL.host}${getFormattedPathName(parsedURL.pathname)}${parsedURL.search}`);
ServerHub.showNewServerModal(`${parsedURL.host}${trimmedPathname}${parsedURL.search}`);
Copy link
Member

Choose a reason for hiding this comment

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

Was getFormattedPathName not necessary here anymore? I think we needed that to ensure that we matched on the correct URL object (since it always appends it when doing toString())

Copy link
Contributor

Choose a reason for hiding this comment

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

Not my code, but my reasoning around this is...

We don't use parsedURL.toString() because we want to remove the protocol (don't know why, but I see no other reason).

And we are joining host + path + searchquery. If path has a slash at the end it feels weird (www.website.com/something/?a=b instead of www.website.com/something?a=b).

No strong feelings here, so happy revert.

e: IpcMainInvokeEvent,
url?: string,
currentId?: string,
originalUrl?: string,
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't look like it's being used anywhere, can we remove it?

@larkox larkox marked this pull request as ready for review December 19, 2025 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2: Dev Review Requires review by a core committer release-note-none

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants