Skip to content

Commit f2ba4b0

Browse files
authored
Boost: remove the ABSPATH from log messages in case logs are made public (#36174)
* Remove local directories from log messages, for security reasons * changelog * Remove ABSPATH completely, so only web accessible paths show * Replace ABSPATH with "[...]/" instead
1 parent 11492fc commit f2ba4b0

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

projects/plugins/boost/app/modules/optimizations/page-cache/pre-wordpress/Logger.php

+3
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ public function log( $message ) {
102102
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash
103103
$request_uri = htmlspecialchars( isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : '<unknown request uri>', ENT_QUOTES, 'UTF-8' );
104104

105+
// don't log the ABSPATH constant. Logs may be copied to a public forum.
106+
$message = str_replace( ABSPATH, '[...]/', $message );
107+
105108
// phpcs:ignore WordPress.WP.AlternativeFunctions.json_encode_json_encode
106109
$line = json_encode(
107110
array(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: fixed
3+
4+
Boost: remove the ABSPATH from log messages in case the logs are made public

0 commit comments

Comments
 (0)