Skip to content

Commit 53dd567

Browse files
committed
Use hash instead of nonce for redirect to payment confirmation.
1 parent 06b5639 commit 53dd567

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Extension.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ public function redirect_url( $url, $payment ) {
529529
$url = add_query_arg(
530530
[
531531
'pay_confirmation' => $payment->get_id(),
532-
'_wpnonce' => wp_create_nonce( 'gf_confirmation_payment_' . $payment->get_id() ),
532+
'hash' => \wp_hash( $payment->get_id() ),
533533
],
534534
$lead['source_url']
535535
);
@@ -1077,16 +1077,16 @@ public function maybe_display_confirmation() {
10771077
return;
10781078
}
10791079

1080-
// Verify nonce.
1081-
if ( ! \array_key_exists( '_wpnonce', $_GET ) ) {
1080+
// Verify hash.
1081+
if ( ! filter_has_var( INPUT_GET, 'hash' ) ) {
10821082
return;
10831083
}
10841084

1085-
$nonce = \sanitize_text_field( \wp_unslash( $_GET['_wpnonce'] ) );
1085+
$hash = \sanitize_text_field( \wp_unslash( filter_input( INPUT_GET, 'hash' ) ) );
10861086

10871087
$payment_id = filter_input( INPUT_GET, 'pay_confirmation', FILTER_SANITIZE_NUMBER_INT );
10881088

1089-
if ( ! wp_verify_nonce( $nonce, 'gf_confirmation_payment_' . $payment_id ) ) {
1089+
if ( \wp_hash( $payment_id ) !== $hash ) {
10901090
return;
10911091
}
10921092

0 commit comments

Comments
 (0)