m3 Security Fixes

This commit is contained in:
Mark Gregory
2026-09-17 10:24:14 +01:00
parent 74f2387dfe
commit c9856d58c1
20 changed files with 234 additions and 201 deletions
+10 -7
View File
@@ -14,6 +14,9 @@ use Str;
class ReplenAPI extends Controller
{
private const ZERO_PAD = '000000';
private const JSON_CONTENT_TYPE = 'application/json';
// M3Replenishement with URL Params
public function M3InventoryReportReplen(Request $request)
{
@@ -25,7 +28,7 @@ class ReplenAPI extends Controller
// Log::info( $request->all() );
// Get The Calling User
$SHUSER = m3_user() !== '' ? Str::upper(m3_user()) : 'WebUser';
$MACPKR = isset($MACPKR) ? $MACPKR : '000000';
$MACPKR = isset($MACPKR) ? $MACPKR : self::ZERO_PAD;
$SHSOURCE = 'M3InventoryReportReplen';
$M3Errors = '';
@@ -83,11 +86,11 @@ class ReplenAPI extends Controller
$token = $IonToken;
$response = Http::withHeaders([
'accept' => 'application/json',
'Content-Type' => 'application/json',
])
'accept' => self::JSON_CONTENT_TYPE,
'Content-Type' => self::JSON_CONTENT_TYPE,
])
->withToken($token)
->withBody($JSON, 'application/json')
->withBody($JSON, self::JSON_CONTENT_TYPE)
->timeout(Config::get('arrays.curlTimeOut'))
->retry(3, 100)
->post($endPointURL);
@@ -226,7 +229,7 @@ class ReplenAPI extends Controller
]);
} else {
// Write to Logs Out : Error
$MACPKR = isset($MACPKR) ? $MACPKR : '000000';
$MACPKR = isset($MACPKR) ? $MACPKR : self::ZERO_PAD;
$data = ['SHMACPKR' => $MACPKR, 'SHDT' => date('Y-m-d'), 'SHTIME' => date('H:i:s'), 'SHERROR' => 'X', 'SHINTBOX' => '', 'SHTYPE' => 'M3-Res-out',
'SHDATA' => 'No URL Parameters Sent', 'SHUSER' => $SHUSER, 'SHSOURCE' => $SHSOURCE, 'SHCO' => $CO, 'SHWHS' => $WHS];
Helper::logToICM699M($data);
@@ -240,7 +243,7 @@ class ReplenAPI extends Controller
}
} catch (\Throwable $th) {
// Write to Logs Out : Error
$MACPKR = isset($MACPKR) ? $MACPKR : '000000';
$MACPKR = isset($MACPKR) ? $MACPKR : self::ZERO_PAD;
$getCurlErrors = str_contains($th->getMessage(), 'cURL error');
if ($getCurlErrors) {