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

pass and preserve a path parameter during the app authentication #13832

Merged
merged 8 commits into from
Jul 1, 2022

Conversation

avatus
Copy link
Contributor

@avatus avatus commented Jun 23, 2022

I left some detailed info in the webapps PR with some reproduction steps

This would add the requested path as a parameter to the redirect_uri during app access, which would only exist from a bookmarked or shared link since our dashboard links to root anyway. This is where the problem arises, when a path is included in a request but the user is unauthenticated, the requested path is lost during the (many) redirects that happen during the authentication process.

Including this query parameter in the final javascript code in the redirection service will keep the path preserved.

Also, cleaned up the state value params to not be hard coded to retrieve from a specific index and instead uses standard getters with URLSearchParams

@github-actions github-actions bot requested review from Joerger and nklaassen June 23, 2022 23:48
@avatus avatus requested a review from r0mant June 23, 2022 23:49
@avatus
Copy link
Contributor Author

avatus commented Jun 23, 2022

The webassets submodule update isnt in yet because I want to get feedback on this before I merge the web one just in case this solution doesn't work out. Will push the webassets update before this is merged in

Copy link
Contributor

@nklaassen nklaassen left a comment

Choose a reason for hiding this comment

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

Would it be feasible to add a test for this?

lib/web/app/redirect.go Outdated Show resolved Hide resolved
lib/web/app/handler.go Outdated Show resolved Hide resolved
@zmb3 zmb3 changed the title pass and preserve a path parameter during the app authenticattion pass and preserve a path parameter during the app authentication Jun 25, 2022
@avatus
Copy link
Contributor Author

avatus commented Jun 29, 2022

Most of the meaningful logic is in the client side js returned so I don't really know if we can/should test that, but I did add a test to the app access logic to ensure any expected paths are added in the path param during the initial app request redirect

@avatus avatus force-pushed the michaelmyers/preserve-app-access-url branch from 5a97047 to 317fbab Compare June 29, 2022 14:55
lib/web/app/redirect.go Outdated Show resolved Hide resolved
lib/web/app/redirect.go Outdated Show resolved Hide resolved
Copy link
Contributor

@nklaassen nklaassen left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for addressing all of my comments

@avatus avatus force-pushed the michaelmyers/preserve-app-access-url branch 5 times, most recently from b4f5ad8 to 944c534 Compare June 30, 2022 21:53
@avatus avatus force-pushed the michaelmyers/preserve-app-access-url branch from 944c534 to 8bc3ae2 Compare July 1, 2022 00:18
@avatus avatus merged commit 4280f81 into master Jul 1, 2022
@github-actions
Copy link

github-actions bot commented Jul 1, 2022

@avatus See the table below for backport results.

Branch Result
branch/v10 Create PR
branch/v8 Create PR
branch/v9 Create PR

avatus added a commit that referenced this pull request Jul 7, 2022
)

* pass and preserve a path parameter during the app access authentication process

* added missing semicolons

* more javascript formatting

* removed incorrect path redirect. replace URL with URL.Path

* added a test for HasName

* added another test for default path

* ensure path param is valid path

* build url without string concat
avatus added a commit that referenced this pull request Jul 7, 2022
…#13… (#14205)

pass and preserve a path parameter during the app authentication (#13832)

* pass and preserve a path parameter during the app access authentication process

* added missing semicolons

* more javascript formatting

* removed incorrect path redirect. replace URL with URL.Path

* added a test for HasName

* added another test for default path

* ensure path param is valid path

* build url without string concat
@zmb3 zmb3 deleted the michaelmyers/preserve-app-access-url branch September 9, 2022 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants