Skip to content

Commit 8ffab64

Browse files
committed
Fixes #481. Added nonce for the detail page for the download link.
Added nonce for the download link on the view log page.
1 parent 0defaee commit 8ffab64

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

plugins/wpgraphql-logging/src/Admin/View/Templates/WPGraphQLLoggerView.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
declare(strict_types=1);
44

5+
use WPGraphQL\Logging\Admin\ViewLogsPage;
6+
57
/**
68
* Log detail view template.
79
*
@@ -17,13 +19,15 @@
1719
<h1><?php esc_html_e( 'Log Entry', 'wpgraphql-logging' ); ?></h1>
1820
<a href="
1921
<?php
22+
$wpgraphql_logging_download_nonce = wp_create_nonce( ViewLogsPage::ADMIN_PAGE_DOWNLOAD_NONCE . '_' . $log->get_id() );
2023
echo esc_url(
2124
admin_url(
2225
sprintf(
23-
'admin.php?page=%s&action=%s&log=%d',
26+
'admin.php?page=%s&action=%s&log=%d&_wpnonce=%s',
2427
\WPGraphQL\Logging\Admin\ViewLogsPage::ADMIN_PAGE_SLUG,
2528
'download',
26-
$log->get_id()
29+
$log->get_id(),
30+
$wpgraphql_logging_download_nonce
2731
)
2832
)
2933
);

0 commit comments

Comments
 (0)