Skip to content

fix(rest-api): fix REST route initialization and secure verify callback against IDOR vulnerability - #1

Open
schinowski wants to merge 2 commits into
oderopay:mainfrom
schinowski:main
Open

fix(rest-api): fix REST route initialization and secure verify callback against IDOR vulnerability#1
schinowski wants to merge 2 commits into
oderopay:mainfrom
schinowski:main

Conversation

@schinowski

Copy link
Copy Markdown

Summary of changes

This PR resolves one issue and one vulnerability within the REST API initialization and verification flows:

  1. Moved the register_rest_route hook out of the gateway constructor to ensure it executes reliably during the rest_api_init lifecycle hook. This resolves rest_no_route errors on redirection that I encountered on a fresh installation.
  2. Security fix against IDOR vulnerability:
    • Added a mandatory key (order_key) validation to the verification endpoint to prevent unauthorised order ID enumeration.
    • Fixed wp_nonce_url HTML escaping in returnUrl, preventing & from being turned into &, which was causing parameter parsing failures.
    • Replaced exceptions with proper WordPress REST API error objects.

Signed-off-by: schinowski <sebastian@puffercode.com>
Signed-off-by: schinowski <sebastian@puffercode.com>
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.

1 participant