Small code fixes in API code
This commit is contained in:
@@ -94,7 +94,7 @@ if ($API_devices->request_method === 'POST') {
|
||||
$requestedPath = realpath($_SERVER['DOCUMENT_ROOT'] . $relativePath);
|
||||
|
||||
// Validate resolved path
|
||||
if (!$requestedPath || strpos($requestedPath, $root) !== 0) {
|
||||
if (!$requestedPath || !str_starts_with($requestedPath, $root)) {
|
||||
http_response_code(403);
|
||||
echo json_encode(['status' => 'error', 'message' => 'Access denied']);
|
||||
exit;
|
||||
|
||||
Reference in New Issue
Block a user