M3 Security Fixes for Pass 35

This commit is contained in:
Mark Gregory
2026-09-17 12:16:42 +01:00
parent e1824f399e
commit 502b226e44
10 changed files with 34 additions and 54 deletions
+9 -9
View File
@@ -231,7 +231,7 @@ class Helper
{
ini_set('max_execution_time', Config::get('arrays.PHPTimeOut'));
$insertSQL = DB::connection(config('m3.connection', 'pgsql'))->table('ICM699M')->insert($data);
DB::connection(config('m3.connection', 'pgsql'))->table('ICM699M')->insert($data);
// dump($insertSQL);
}
@@ -251,10 +251,10 @@ class Helper
return $substring;
}
public static function checkLength($JSONL, $DBL, $TYPE)
public static function checkLength($jsonFields, $dbFields, $type)
{
// Check type
$jSONType = gettype($JSONL);
$jSONType = gettype($jsonFields);
switch ($jSONType) {
case 'string':
@@ -271,24 +271,24 @@ class Helper
break;
}
$TYPE = $TYPE == 'integer' || $TYPE == 'DEC' ? 'number' : $TYPE;
$type = $type == 'integer' || $type == 'DEC' ? 'number' : $type;
// Check Json Field should be < DB Field
$lengthOK[413] = (strlen($JSONL) <= $DBL) ? true : false;
$lengthOK[413] = (strlen($jsonFields) <= $dbFields) ? true : false;
// Empty Fields
$lengthOK[411] = true; // !empty($JSONL) ? true : false ;
$lengthOK[411] = true; // !empty($jsonFields) ? true : false ;
// Wrong Types
$lengthOK[417] = true; // $jSONTypeConv == $TYPE ? true : false ;
$lengthOK[417] = true; // $jSONTypeConv == $type ? true : false ;
// Log::info($lengthOK);
return $lengthOK;
}
public static function sanityzeString($StrTosanityze)
public static function sanityzeString($strToSanitize)
{
$badChars = Config::get('arrays.BadChars');
$goodString = trim($StrTosanityze);
$goodString = trim($strToSanitize);
$goodString = str_replace("'", '', $goodString);
$goodString = str_replace("\u{f0e0}", '', $goodString);
$goodString = preg_replace('/\\\\u201[0-9A-F]+/i', '', $goodString);