Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(site): sanitize login redirect#15208

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
coadler merged 10 commits intomainfromcolin/login-redirect
Oct 24, 2024
Merged

fix(site): sanitize login redirect#15208

coadler merged 10 commits intomainfromcolin/login-redirect
Oct 24, 2024

Conversation

coadler
Copy link
Contributor

No description provided.

@coadlercoadler self-assigned thisOct 23, 2024
@coadlercoadler requested a review fromEmyrkOctober 23, 2024 23:49
// `<Navigate>` react would handle the redirect itself and never request the
// page from the backend.
if (isSignedIn && isApiRouteRedirect) {
const sanitizedUrl = new URL(redirectTo, window.location.origin);
Copy link
Member

Choose a reason for hiding this comment

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

This does not work for subdomain apps though right? If they are on another domain?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

They're not on another domain. The redirect from a workspace proxy subdomain app is to/api/v2/applications/auth-redirect. The redirect sanitization happens there.

Copy link
Member

Choose a reason for hiding this comment

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

I'll trust you 👍

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I could be wrong but that's what I always noticed in my testing.

Copy link
Member

@kylecarbskylecarbs left a comment

Choose a reason for hiding this comment

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

approving but remove your dep

package.json Outdated
@@ -9,6 +9,7 @@
"storybook": "pnpm run -C site/ storybook"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
Copy link
Member

Choose a reason for hiding this comment

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

no

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

biome extension doesn't work in vscode unless you have dep in root dir 😢

Copy link
Member

@ParkreinerParkreiner left a comment

Choose a reason for hiding this comment

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

Mainly had a question about whether another file needs to be updated

}
if (isSignedIn && !isApiRouteRedirect) {
return (
<Navigate to={redirectUrl ? redirectUrl.pathname : redirectTo} replace />
Copy link
Member

Choose a reason for hiding this comment

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

So I poked around a bit more of the code, and I'm just making sure: there's a second file that calls theretrieveRedirect function (LoginPageView.tsx). Do we need to update anything around that?

Because right now, the control flow is set up so that the component:

  1. Gets theredirectTo value from the search param'sredirect param
  2. Passes it to theSignInForm
  3. Passes that to theOAuthSignInForm
  4. As long as GitHub is enabled as an auth method, a button shows up with an href that uses the rawredirectTo as a param

Not sure how the callback logic works, but would the updates to this file catch any issues from there?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yeah, good find. This is being sent directly to the backend which handles approving the redirect URLs, so it doesn't need any validation from the frontend.

@coadlercoadler marked this pull request as ready for reviewOctober 24, 2024 18:56
@coadlercoadler changed the titlechore(site): login redirectfix(site): sanitize login redirectOct 24, 2024
@coadlercoadler merged commit69c1d98 intomainOct 24, 2024
33 checks passed
@coadlercoadler deleted the colin/login-redirect branchOctober 24, 2024 18:59
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsOct 24, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@EmyrkEmyrkEmyrk left review comments

@ParkreinerParkreinerParkreiner left review comments

@kylecarbskylecarbskylecarbs approved these changes

Assignees

@coadlercoadler

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@coadler@Emyrk@kylecarbs@Parkreiner

[8]ページ先頭

©2009-2025 Movatter.jp