Suppose that a user is on node/1 and clicks on a link to node/1/addfavorites?destination=node/1&argument=123123. Then the page callback for node/1/addfavorites tries to fetch an access token.

Once the authentication and authorization is done on the server, we are redirected by the server to the redirect uri: oauth2/authorized. This page should then redirect the user in the saved path node/1/addfavorites?destination=node/1&argument=123123, and then this page should redirect the user to node/1.

Currently, the page oauth2/authorized redirects directly to node/1, which is wrong, because the page node/1/addfavorites is trying to get an access token, not the page node/1.

Comments

dashohoxha created an issue. See original summary.

dashohoxha’s picture

  1. Function drupal_get_destination() is also affected by $_GET['destination'], so it has to be handled carefully.
  2. If a $_GET['destination'] comes from a malicious or stupid server, it can totally disrupt the work of the application by misguiding and cheating drupal_goto().
dashohoxha’s picture

Status: Active » Needs review
chrisguindon’s picture

Status: Needs review » Reviewed & tested by the community

This patch works for me!

dashohoxha’s picture

By looking at the definition of drupal_get_destination(), I arrived at this new patch, which is simpler, and I believe is equivalent with the previous one.

dashohoxha’s picture

Status: Reviewed & tested by the community » Needs review
chrisguindon’s picture

Status: Needs review » Reviewed & tested by the community

patch #5 applies cleanly for me and I do prefer the simplicity of this new patch! I tested it on my site and it's working!

  • dashohoxha committed e81241b on 7.x-1.x
    Issue #2789501 by dashohoxha: Fix chain redirections
    
dashohoxha’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.