Skip to content

Implicit grant success redirect uses wp_safe_redirect(), likely broken for foreign-host clients #16

Description

@roborourke

inc/types/class-implicit.php:102 redirects to the client's callback with wp_safe_redirect() on the success path. There is no allowed_redirect_hosts filter registered anywhere in this plugin, so wp_validate_redirect() rejects any callback on a host other than the current site and silently falls back to admin_url().

This means the implicit grant likely can't complete for any client whose callback isn't on the same host as the WordPress install — which is the normal case.

The authorization_code grant's success path already gets this right at inc/types/class-authorization-code.php:166-167, using wp_redirect() with a phpcs:ignore WordPress.Security.SafeRedirect and a comment explaining why it's safe (the redirect URI has already been validated against the client's registration). Apply the same fix here.

Found while fixing the equivalent bug in the new PKCE error-redirect paths (inc/types/class-base.php, inc/types/class-authorization-code.php) on the add-pkce-support branch.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions