Bug found in WPMU DEV Dashboard - Unable to logout

WPMU DEV Dashboard plugin, version 4.0.7

The plugin is unable to logout from an already synced WPMUDEV account. It just keeps logged in even after deactivating, deleting, reinstalling and activating the plugin again. I am proposing a fix at the bottom of this post.

This is a video of the bug: https://www.youtube.com/watch?v=jkO_ed_lONc

And this is what happens technically:

1 - When pushing the log out button, it redirects to the dashboard page, with a GET variable set in the URL "clear_key=1"
2 - The server processes the request: in the WPMUDEV_Dashboard_Api class constructor, it checks if we have the clear_key GET variable and if so, it doesn't load the api key from the database, so the api_key remains as an empty string.
3 - Then, when reaching render_dashboard() in the WPMUDEV_Dashboard_Ui class, as the clear_key GET variable is set, it calls the WPMUDEV_Dashboard_Site->logout, which simply returns false because we don't have an api key set.
4- The render_dashboard() method in WPMUDEV_Dashboard_Ui continues running and renders the login page, without logging out the user, so, in the next request, the user will be logged in "magically".

I fixed it by taking into account the clear_key GET variable when evaluating if we need to clear the key from the database or not... so, in the WPMUDEV_Dashboard_Site class logout function, I replaced this:

// Prevent infinite loops...
if ( ! WPMUDEV_Dashboard::$api->has_key()) { return false; }

With this:

// Prevent infinite loops...
if ( ! WPMUDEV_Dashboard::$api->has_key() && empty( $_GET['clear_key'] )) { return false; }

And everything is working fine now =). I would make a pull request or something if I just had access to the developer repositories.

  • Adam Czajczyk
    • Support Gorilla

    Hello Emmanuel,

    I hope you're well today!

    I just tested this on my own setup and I can fully confirm the issue. You've also run a great investigation and your fix seems simple and efficient. That said, I'm immediately forwarding this to WPMU DEV Dashboard plugin developer and hopefully he'll include it in future release.

    Thanks again and keep up great work!

    Best regards
    Adam

  • Adam Czajczyk
    • Support Gorilla

    Hey Emmanuel!

    So you're willing to work with us? That's great, I keep my fingers crossed for you! I don't know who's running developers recruitment currently on our side but I'm sure that since you're member of our community that person will notice your activity :slight_smile:

    Good luck!
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.