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
+6 -10
View File
@@ -32,12 +32,7 @@ class ClosedOrderSaveXls extends Command
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
/**
* Execute the console command.
*
* @return int
@@ -100,7 +95,7 @@ class ClosedOrderSaveXls extends Command
str_replace('-', '', $to),
$file,
! Storage::disk('publicCL')->exists($file),
'Last Month',
'Last Month'
);
}
@@ -122,7 +117,7 @@ class ClosedOrderSaveXls extends Command
str_replace('-', '', $to),
$file,
true,
'Current Month',
'Current Month'
);
}
@@ -134,7 +129,7 @@ class ClosedOrderSaveXls extends Command
string $to,
string $file,
bool $shouldGenerate,
string $label,
string $label
): void {
$this->info('From Date: ' . $from);
$this->info('To Date: ' . $to);
@@ -222,7 +217,8 @@ SQL;
Log::channel('dailyCron')->info(
'Maximum allowed records for Excel export is: ' . number_format($maxRecords)
. ' current records: ' . number_format($count),
. ' current records: ' . number_format($count)
);
}
}
+1 -6
View File
@@ -28,12 +28,7 @@ class DeleteOldLabels extends Command
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
/**
* Execute the console command.
*
* @return int
+1 -6
View File
@@ -36,12 +36,7 @@ class GenerateGS1Cmd extends Command
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
/**
* Execute the console command.
*
* @return int
+1 -6
View File
@@ -29,12 +29,7 @@ class UtilitiesCmd extends Command
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
/**
* Execute the console command.
*
* @return int
+1 -6
View File
@@ -29,12 +29,7 @@ class WHSMetricsSaveXls extends Command
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
/**
* Execute the console command.
*
* @return int
+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);
@@ -5,6 +5,7 @@ namespace Modules\M3\Http\Controllers\API;
use Config;
use DB;
use Illuminate\Http\Request;
use Log;
use Modules\M3\Helpers\Helper;
use Modules\M3\Http\Controllers\Controller;
use Modules\M3\Services\PostgresProgramBridge;
@@ -13,7 +14,6 @@ use Str;
class M3Controller extends Controller
{
private const FIELD_PREFIX = 'Field: ';
private const M3_LIST_SUFFIX = ' M3-Lis-JSN';
// Split Data and Write to ICM666M2
@@ -28,7 +28,7 @@ class M3Controller extends Controller
$fullData = $commentData;
$fullData['AXCOMMENT'] = $substring;
$fullData['AXLINENO'] = $aXLINENO;
$insertSQL = DB::connection(config('m3.connection', 'pgsql'))->table('icm666m2')->insert($fullData);
DB::connection(config('m3.connection', 'pgsql'))->table('icm666m2')->insert($fullData);
$aXLINENO++;
@@ -414,7 +414,7 @@ class M3Controller extends Controller
// }
// SQL Insert to ICM666M
$insertSQL = DB::connection(config('m3.connection', 'pgsql'))->table('icm666m')->insert($insertArray);
DB::connection(config('m3.connection', 'pgsql'))->table('icm666m')->insert($insertArray);
}
// Call PGM ICM700CSBM
@@ -62,7 +62,7 @@ class ReplenishSettingsController extends Controller
$formInputs['R658IZLCF'] = isset($formInputs['R658IZLCF']) ? $formInputs['R658IZLCF'] : '0';
$iCM658MINS = ICM658M::insert($formInputs);
ICM658M::insert($formInputs);
return redirect()->route('m3.replenishmentSettings.index');
}
@@ -97,7 +97,7 @@ class ReplenishSettingsController extends Controller
$r658PL = trim($request->R658PL);
$r658WH = trim($request->R658WH);
$deleteRecord = DB::connection(config('m3.connection', 'pgsql'))->table('icm658m')
DB::connection(config('m3.connection', 'pgsql'))->table('icm658m')
->where('R658PN', $r658PN)
->where('R658CO', $r658CO)
->where('R658LC', $r658LC)
@@ -176,6 +176,7 @@ class ReplenishSettingsController extends Controller
// $rEFCAT658 = DB::connection(config('m3.connection', 'pgsql'))->select($sqlstmt);
// dd($rEFCAT658);
return Datatables::of($rEFCAT658)->addIndexColumn()->make(true);
}
}
@@ -33,13 +33,13 @@ class sentinelController extends Controller
$time1 = date('His');
// Delete Records from ICM695M1 And ICM695M2
$iCM695M1Del = DB::connection(config('m3.connection', 'pgsql'))->table('icm695m1')
DB::connection(config('m3.connection', 'pgsql'))->table('icm695m1')
->where('AYINTBOX', $aYINTBOX)
->where('AYCO', $aYCO)
->where('AYWHS', $aYWHS)
->delete();
$iCM695M2Del = DB::connection(config('m3.connection', 'pgsql'))->table('icm695m2')
DB::connection(config('m3.connection', 'pgsql'))->table('icm695m2')
->where('AZINTBOX', $aYINTBOX)
->where('AZCO', $aYCO)
->where('AZWHS', $aYWHS)
@@ -49,7 +49,7 @@ class sentinelController extends Controller
$insertValues = "'$iCM695M1Sel->AYCO', '$iCM695M1Sel->AYWHS', '$iCM695M1Sel->AYSENTPKR', '$iCM695M1Sel->AYMACPKR', '$iCM695M1Sel->AYONO', '$iCM695M1Sel->AYRLNO', '$iCM695M1Sel->AYSHNO', '', 'Box $aYINTBOX emptied and repacked',
'$timestamp', '$date1', '$time1', '$aYUSER','$timestamp', '$date1', '$time1', '$aYUSER','$aYINTBOX'";
$iCM689MInsert = DB::connection(config('m3.connection', 'pgsql'))->insert("INSERT INTO ICM689M
DB::connection(config('m3.connection', 'pgsql'))->insert("INSERT INTO ICM689M
(A7CO, A7WHS, A7SENTPKR, A7MACPKR, A7ONO, A7RLNO, A7SHNO, A7SOURCE, A7ERRMSG, A7DISRAITS, A7DISRAID, A7DISRAIT, A7DISRAIU, A7DISRESTS ,A7DISRESD ,A7DISREST ,A7DISRESU , A7SPR15A01)
values ($insertValues)");
@@ -66,6 +66,7 @@ class utilitiesContoller extends Controller
// Add Delivery Note Param
$params[] = $conn->AddParameterPackDec('in', 11, 0, 'ParamIn', '', '00000087125');
// Start Time Tracking
$start = microtime(true);
@@ -171,7 +172,7 @@ class utilitiesContoller extends Controller
dump('ICM688M2 Record: ' . $a5MACPKR . '-' . $a5SENTPKR);
$iCM799MINS = DB::connection(config('m3.connection', 'pgsql'))->table('icm799m')
DB::connection(config('m3.connection', 'pgsql'))->table('icm799m')
->where('IMDELNO', '=', $a5MACPKR)
->update(['IMSENTPKR' => $a5SENTPKR]);
}
@@ -355,7 +356,7 @@ class utilitiesContoller extends Controller
$packageNum++;
// Insert new Record to ICM695M3 $gs1_128_bc
$iCM695M3SQLInsert = DB::connection(config('m3.connection', 'pgsql'))->table('icm695m3')
DB::connection(config('m3.connection', 'pgsql'))->table('icm695m3')
->insert(['A2CO' => $cOMPANY, 'A2WHS' => $wHS, 'A2PLANT' => $pLANT, 'A2MACPKR' => $macpkr, 'A2GS1LABEL' => $gs1_128_bc, 'A2INTBOX' => $a2INTBOX]);
Log::channel('LabelCron')->info('<<< GS1-128...End of Label Creation for Mackpkr: ' . $macpkr);
@@ -398,9 +399,10 @@ class utilitiesContoller extends Controller
}
// # Insert new Record to ICM695M3 $gs1_128_bc
// $iCM695M3SQLInsert = DB::connection(config('m3.connection', 'pgsql'))->table('icm695m3')
// DB::connection(config('m3.connection', 'pgsql'))->table('icm695m3')
// ->insert(['A2CO'=> $cOMPANY,'A2WHS'=> $wHS,'A2MACPKR'=> $macpkr,'A2GS1LABEL'=> $gs1_128_bc]);
return json_encode(['result' => 'success', 'GS1File' => $gS1FileNameNoRoot]);
} catch (\Throwable $th) {
@@ -517,6 +519,7 @@ class utilitiesContoller extends Controller
</body>
</html>';
// Initialize Dompdf
$dompdf = new Dompdf;
$dompdf->loadHtml($html);