fix(security): fix pervasive IDOR - force JWT user identity in 9 endpoints, fix host injection, exception leaks, wallet auth
This commit is contained in:
@@ -17,7 +17,12 @@ function generateUniqueCode($con) {
|
||||
}
|
||||
}
|
||||
|
||||
$driverId = filterRequest("driverId");
|
||||
// Force driverId from JWT — only drivers can manage invitations
|
||||
if ($role !== 'driver') {
|
||||
jsonError("Only drivers can create invitations");
|
||||
exit;
|
||||
}
|
||||
$driverId = $user_id;
|
||||
$inviterDriverPhone = filterRequest("inviterDriverPhone");
|
||||
|
||||
// 🔐 تشفير رقم الهاتف
|
||||
@@ -52,7 +57,8 @@ if ($checkStmt->rowCount() > 0) {
|
||||
"expirationTime" => $expirationTime
|
||||
]);
|
||||
} catch (PDOException $e) {
|
||||
jsonError("Database error: " . $e->getMessage());
|
||||
error_log("[invitor/add] DB Error: " . $e->getMessage());
|
||||
jsonError("Database error occurred");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +89,8 @@ if ($checkStmt->rowCount() > 0) {
|
||||
jsonError("Failed to save invite data");
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
jsonError("Database error: " . $e->getMessage());
|
||||
error_log("[invitor/add] DB Error: " . $e->getMessage());
|
||||
jsonError("Database error occurred");
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user