fix(livewire): add Locked attributes and consolidate container name validation

- Add #[Locked] to server-set properties on Import component (resourceId,
  resourceType, serverId, resourceUuid, resourceDbType, container) to
  prevent client-side modification via Livewire wire protocol
- Add container name validation in runImport() and restoreFromS3()
  using shared ValidationPatterns::isValidContainerName()
- Scope server lookup to current team via ownedByCurrentTeam()
- Consolidate duplicate container name regex from Import,
  ExecuteContainerCommand, and Terminal into shared
  ValidationPatterns::isValidContainerName() static helper
- Add tests for container name validation, locked attributes, and
  team-scoped server lookup

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai
2026-03-25 20:21:39 +01:00
parent 0fed553207
commit d486bf09ab
5 changed files with 158 additions and 3 deletions
+8
View File
@@ -163,6 +163,14 @@ class ValidationPatterns
return ['string', 'max:'.$maxLength, 'regex:'.self::CONTAINER_NAME_PATTERN];
}
/**
* Check if a string is a valid Docker container name.
*/
public static function isValidContainerName(string $name): bool
{
return preg_match(self::CONTAINER_NAME_PATTERN, $name) === 1;
}
/**
* Get combined validation messages for both name and description fields
*/