| @@ -83,10 +83,19 @@ | ||
| 83 | 83 | */ |
| 84 | 84 | public function snippetCreated($snippet, $table): void |
| 85 | 85 | { |
| 86 | 86 | // Will not work in newer versions of Code Snippets |
| 87 | - $cloneId = sanitize_text_field($_GET['action'] ?? null) == 'clone' | |
| 88 | - ? sanitize_text_field($_GET['id'] ?? null) | |
| 87 | + // phpcs:disable WordPress.Security.NonceVerification.Recommended -- Passive logger reads Code Snippets request state after that plugin handles auth. | |
| 88 | + $action = isset($_GET['action']) | |
| 89 | + ? sanitize_text_field(wp_unslash($_GET['action'])) | |
| 90 | + : null; | |
| 91 | + $id = isset($_GET['id']) | |
| 92 | + ? sanitize_text_field(wp_unslash($_GET['id'])) | |
| 93 | + : null; | |
| 94 | + // phpcs:enable WordPress.Security.NonceVerification.Recommended | |
| 95 | + | |
| 96 | + $cloneId = $action == 'clone' | |
| 97 | + ? $id | |
| 89 | 98 | : null; |
| 90 | 99 | |
| 91 | 100 | $logger = Logtivity::log() |
| 92 | 101 | ->setAction('Code Snippet Created') |