feat: improve S3 restore path handling and validation state

- Add path attribute mutator to S3Storage model ensuring paths start with /
- Add updatedS3Path hook to normalize path and reset validation state on blur
- Add updatedS3StorageId hook to reset validation state when storage changes
- Add Enter key support to trigger file check from path input
- Use wire:model.live for S3 storage select, wire:model.blur for path input
- Improve shell escaping in restore job cleanup commands
- Fix isSafeTmpPath helper logic for directory validation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai
2025-11-25 10:18:30 +01:00
parent 6d8144c18c
commit 875351188f
7 changed files with 166 additions and 18 deletions
+8 -10
View File
@@ -3250,18 +3250,16 @@ function isSafeTmpPath(?string $path): bool
$dirPath = dirname($resolvedPath);
// If the directory exists, resolve it via realpath to catch symlink attacks
if (file_exists($resolvedPath) || is_dir($dirPath)) {
if (is_dir($dirPath)) {
// For existing paths, resolve to absolute path to catch symlinks
if (is_dir($dirPath)) {
$realDir = realpath($dirPath);
if ($realDir === false) {
return false;
}
$realDir = realpath($dirPath);
if ($realDir === false) {
return false;
}
// Check if the real directory is within /tmp (or its canonical path)
if (! str($realDir)->startsWith('/tmp') && ! str($realDir)->startsWith($canonicalTmpPath)) {
return false;
}
// Check if the real directory is within /tmp (or its canonical path)
if (! str($realDir)->startsWith('/tmp') && ! str($realDir)->startsWith($canonicalTmpPath)) {
return false;
}
}