Update: 2026-06-16 01:17:28
This commit is contained in:
@@ -18,8 +18,7 @@ try {
|
||||
// =================================================================================
|
||||
function broadcastRideToMarket($rideId, $lat, $lng, $payloadData) {
|
||||
$url = getenv('LOCATION_SOCKET_URL');
|
||||
$keyPath = getenv('INTERNAL_SOCKET_KEY_PATH');
|
||||
$INTERNAL_KEY = $keyPath && file_exists($keyPath) ? trim(file_get_contents($keyPath)) : '';
|
||||
$INTERNAL_KEY = function_exists('getInternalSocketKey') ? getInternalSocketKey() : '';
|
||||
|
||||
$marketPayload = [
|
||||
'id' => (string)$rideId,
|
||||
@@ -138,6 +137,19 @@ if (!isset($tokenData['prices'][$carType])) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// ✅ FIX H-05: التحقق من distance و duration في الـ token أيضاً
|
||||
if (isset($tokenData['distance']) && $tokenData['distance'] != $distance) {
|
||||
error_log("[add_ride] Security failed — distance mismatch.");
|
||||
printFailure("Tampered ride data (distance mismatch)");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($tokenData['duration']) && $tokenData['duration'] != $duration_text) {
|
||||
error_log("[add_ride] Security failed — duration mismatch.");
|
||||
printFailure("Tampered ride data (duration mismatch)");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Securely override pricing from the cryptographically signed token
|
||||
$price = $tokenData['prices'][$carType]['price'];
|
||||
$price_for_driver = $tokenData['prices'][$carType]['driver_price'];
|
||||
|
||||
Reference in New Issue
Block a user