Skip to content

Commit 8fe1348

Browse files
committed
fix: esc
1 parent a77fb97 commit 8fe1348

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

backend/app/Providers/AccessControlProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public function scanFile($command, $args)
218218
}
219219

220220
if (\count($this->scannedResult) > 0) {
221-
throw new PreCommandException(wp_strip_all_tags(implode('. >> ', $this->scannedResult)));
221+
throw new PreCommandException(esc_html(implode('. >> ', $this->scannedResult)));
222222
}
223223
}
224224

backend/app/Providers/FileEditValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function checkSyntax($content, $realFile)
4141
if ($wpError instanceof WP_Error) {
4242
$message = $wpError->get_error_message();
4343

44-
throw new PreCommandException(wp_strip_all_tags($message));
44+
throw new PreCommandException(esc_html($message));
4545
}
4646
}
4747

backend/app/Providers/PhpSyntaxChecker.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ private function loopbackRequest()
9191
// Include Basic auth in loopback requests.
9292
if (isset($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])) {
9393
$headers['Authorization'] = 'Basic ' . base64_encode(
94-
wp_unslash($_SERVER['PHP_AUTH_USER']) . ':' . wp_unslash($_SERVER['PHP_AUTH_PW'])
94+
// phpcs:disable WordPress.Security.ValidatedSanitizedInput -- We need to sanitize the username, but the password should be left as-is.
95+
sanitize_user(wp_unslash($_SERVER['PHP_AUTH_USER'])) . ':' . wp_unslash($_SERVER['PHP_AUTH_PW'])
9596
);
9697
}
9798

0 commit comments

Comments
 (0)