Skip to content

Commit

Permalink
Fixed vulnerability in json.php caused my missing Content-Type header
Browse files Browse the repository at this point in the history
  • Loading branch information
adolfintel committed Apr 27, 2024
1 parent 748f49c commit dd1ce2c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions results/json.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

error_reporting(0);
header('Content-Type: application/json; charset=utf-8');

require_once 'telemetry_db.php';

/**
Expand Down Expand Up @@ -53,7 +56,7 @@ function formatSpeedtestData($speedtest)
$speedtest = getSpeedtestUserById($_GET['id']);
if (!is_array($speedtest)) {
echo '{}';
} else {
$speedtest = formatSpeedtestData($speedtest);
echo json_encode(array('timestamp'=>$speedtest['timestamp'],'download'=>$speedtest['dl'],'upload'=>$speedtest['ul'],'ping'=>$speedtest['ping'],'jitter'=>$speedtest['jitter'],'ispinfo'=>$speedtest['ispinfo']));
}
$speedtest = formatSpeedtestData($speedtest);

echo json_encode(array('timestamp'=>$speedtest['timestamp'],'download'=>$speedtest['dl'],'upload'=>$speedtest['ul'],'ping'=>$speedtest['ping'],'jitter'=>$speedtest['jitter'],'ispinfo'=>$speedtest['ispinfo']));
2 changes: 1 addition & 1 deletion speedtest.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function Speedtest() {
this._settings = {}; //settings for the speed test worker
this._state = 0; //0=adding settings, 1=adding servers, 2=server selection done, 3=test running, 4=done
console.log(
"LibreSpeed by Federico Dossena v5.3.0 - https://github.com/librespeed/speedtest"
"LibreSpeed by Federico Dossena v5.3.1 - https://github.com/librespeed/speedtest"
);
}

Expand Down

0 comments on commit dd1ce2c

Please sign in to comment.