Skip to content

[PEGASUS-935] Redirect to default unauthorised zendesk url when SSO is disabled #159

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

Merged

Conversation

yoshdog
Copy link
Contributor

@yoshdog yoshdog commented Jun 30, 2020

When SSO is disabled, we should redirect to the default Zendesk unauthorised URL instead of the defined redirect url thats passed from the user.

@yoshdog yoshdog changed the title Redirect to default unauthorised zendesk url when SSO is disabled [PEGASUS-935] Redirect to default unauthorised zendesk url when SSO is disabled Jun 30, 2020
@yoshdog yoshdog requested a review from thekindofme June 30, 2020 11:04
@@ -27,13 +27,13 @@ public function loginAction()
{
$return_url = Mage::helper('core')->urlDecode($this->getRequest()->getParam('return_url', ""));
Copy link

Choose a reason for hiding this comment

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

Not sure if this is meant to be decoding. Usually you would be taking the raw value and when adding it back to the URL below you would encode it.

Currently you could add additional query parameters to the resulting URL going to Zendesk due to lack of encoding and the manual query building. Probably benign but doesn’t seem intentional.

I would recommend http_build_query below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

merging this as is... happy to look into this in a followup PR.

Copy link

Choose a reason for hiding this comment

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

Yes the return URL could contain ampersand. In which case rather than being elements of the return url they would become additional query parameters sent to the JWT endpoint. So could cause undesired behaviour.

For example If url is: http://hello/something?query&something=more

The resulting url in the redirect becomes:
https://zendeskdomain/access/jwt?jwt=accesstoken&return_to=http://hello/something?query&something=more
So not only not encoded but the final part won’t be part of the return_to and will be stripped when the return happens.

Can’t see if causing an issue except maybe breaking some return URLs. But I don’t know what parameters that endpoint accepts.

@yoshdog yoshdog merged commit b31346d into master Jul 2, 2020
@yoshdog yoshdog deleted the PEGASUS-935-investigate-reported-sso-open-redirect-vulnerabili branch July 2, 2020 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants