fix(server-transfer): harden import on Cloud and stop archives from using server slots

- Rate limit the import check probe and refuse private, loopback, and
  link-local targets on Cloud.
- Rate limit the SSH validation that an import starts, like other
  server validations.
- Count only managed servers for the server limit, the limit check job,
  and the subscription page. Archives of transferred servers are left out.
- Do not show the name of another team's archived server in the import check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai
2026-10-23 20:12:59 +02:00
co-authored by Claude Opus 5.5
parent 30d840f1c6
commit 95a3a22fdf
9 changed files with 106 additions and 9 deletions
+10 -2
View File
@@ -158,7 +158,7 @@ class Team extends Model implements SendsDiscord, SendsEmail, SendsPushover, Sen
return true;
}
$serverLimit = Team::serverLimit($team);
$servers = $team->servers()->count();
$servers = $team->managedServers()->count();
return $servers >= $serverLimit;
}
@@ -192,7 +192,7 @@ class Team extends Model implements SendsDiscord, SendsEmail, SendsPushover, Sen
public function serverOverflow()
{
if (Team::serverLimit($this) < $this->servers->count()) {
if (Team::serverLimit($this) < $this->managedServers()->count()) {
return true;
}
@@ -392,6 +392,14 @@ class Team extends Model implements SendsDiscord, SendsEmail, SendsPushover, Sen
return $this->hasMany(Server::class);
}
/**
* Servers that use a server slot. Archives of transferred servers are left out.
*/
public function managedServers()
{
return $this->servers()->notTransferredAway();
}
public function usesSwarm(): bool
{
return $this->servers()