Skip to content

Commit e2189aa

Browse files
Andrew Bakerclaude
andcommitted
Fix MEDIUM security issues: SQL file-system clauses and CDN disclosure
- is_safe_query(): block INTO OUTFILE, INTO DUMPFILE, LOAD_FILE clauses - readme.txt: add == External services == section disclosing cdnjs CDN dependency Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 0ab10ff commit e2189aa

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

cs-code-block.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,10 @@ private static function is_safe_query( string $sql ): bool {
926926
if ( strpos( $clean, ';' ) !== false ) {
927927
return false;
928928
}
929+
// Reject file-system abuse clauses regardless of SELECT keyword.
930+
if ( preg_match( '/\b(INTO\s+OUTFILE|INTO\s+DUMPFILE|LOAD_FILE)\b/i', $clean ) ) {
931+
return false;
932+
}
929933
if ( preg_match( '/^(\w+)/i', $clean, $m ) ) {
930934
$first = strtoupper( $m[1] );
931935
return in_array( $first, [ 'SELECT', 'SHOW', 'DESCRIBE', 'DESC', 'EXPLAIN' ], true );

readme.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,17 @@ Yes. Press Enter to run the query. Use Shift+Enter to insert a newline. Ctrl+Ent
149149
= 1.0.0 =
150150
* Initial release
151151

152+
== External services ==
153+
154+
This plugin loads syntax highlighting scripts and stylesheets from the cdnjs CDN operated by Cloudflare, Inc.
155+
156+
* Service: cdnjs (https://cdnjs.cloudflare.com/)
157+
* When: On every page that contains a code block (frontend and block editor).
158+
* What is sent: Standard HTTP request headers including visitor IP address and user agent, as required by any CDN request. No site content or user data is transmitted by the plugin itself.
159+
* Why: To serve the highlight.js library and theme stylesheets without bundling them locally.
160+
* Cloudflare Privacy Policy: https://www.cloudflare.com/privacypolicy/
161+
* Cloudflare Terms of Service: https://www.cloudflare.com/terms/
162+
152163
== Upgrade Notice ==
153164

154165
= 1.7.3 =

0 commit comments

Comments
 (0)