mirror of
https://github.com/tiennm99/coolify.git
synced 2026-08-15 18:23:22 +00:00
fix(destination): validate network server pairing
Ensure destination attach and promote operations only accept networks that belong to the selected server, preventing mismatched same-team server/network pairs.
This commit is contained in:
@@ -112,7 +112,7 @@ class Destination extends Component
|
||||
{
|
||||
try {
|
||||
$server = Server::ownedByCurrentTeam()->findOrFail($server_id);
|
||||
$network = StandaloneDocker::ownedByCurrentTeam()->findOrFail($network_id);
|
||||
$network = StandaloneDocker::ownedByCurrentTeam()->where('server_id', $server->id)->findOrFail($network_id);
|
||||
$this->authorize('update', $this->resource);
|
||||
|
||||
$main_destination = $this->resource->destination;
|
||||
@@ -140,7 +140,7 @@ class Destination extends Component
|
||||
{
|
||||
try {
|
||||
$server = Server::ownedByCurrentTeam()->findOrFail($server_id);
|
||||
$network = StandaloneDocker::ownedByCurrentTeam()->findOrFail($network_id);
|
||||
$network = StandaloneDocker::ownedByCurrentTeam()->where('server_id', $server->id)->findOrFail($network_id);
|
||||
$this->authorize('update', $this->resource);
|
||||
|
||||
$this->resource->additional_networks()->attach($network->id, ['server_id' => $server->id]);
|
||||
|
||||
Reference in New Issue
Block a user