Cut over-engineering found by a repo-wide audit
docker / test (8.5) (push) Successful in 3m10s
linter / quality (push) Successful in 1m5s
tests / ci (8.5) (push) Successful in 3m9s
docker / build-and-push (push) Successful in 21m5s
docker / release (push) Skipped

- Config: auth, services, logging, queue and database only repeated the
  framework's own files and are gone; the others keep only the keys that
  differ (app version, cache serializable_classes, session cookie name,
  Markdown mail theme, the shares disk, three Octane values, Livewire's
  pagination theme and payload guards).
- Email verification is removed: User never implemented MustVerifyEmail,
  so it was never enforced, and SealShare has a single admin and no
  registration. CreateNewUser goes with it.
- FileEncryptionService::encryptFile() and generateSalt() were only used
  by tests; tests build files with encryptTestFile() in tests/Pest.php.
- The expiration options are defined once, as Share::EXPIRATIONS. "30 Days"
  now lasts 30 days instead of a calendar month, and Admin settings only
  save a default expiration that is one of the options.
- One-caller helpers are inlined, the uploader reads chunk responses with
  XHR's responseType, and starter-kit leftovers are removed.
- Docker: PHP reads the PHP_* limits from the environment itself
  (${VAR:-default} in uploads.ini); both entrypoints stop writing the ini.
  docker-compose.yml shares the app and scheduler variables through one
  anchor. The dev image installs gd for the screenshot publisher and fake
  test images.
- Development runs in Docker only: the composer dev script, concurrently,
  laravel/pail, laravel/sail, autoprefixer and the shell-quote override
  are gone.
- phpunit.xml forces the test environment with <server> entries, so tests
  run in the dev container no longer use its real database.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
surtic86
2026-09-18 23:14:33 +02:00
co-authored by Claude Opus 5
parent a62edbcefb
commit 4530298398
57 changed files with 240 additions and 2784 deletions
-62
View File
@@ -53,14 +53,6 @@ class FileEncryptionService
return hash_pbkdf2('sha256', $password, hex2bin($salt), self::PBKDF2_ITERATIONS, self::KEY_LENGTH, true);
}
/**
* Generate a random hex salt (32 bytes = 64 hex chars).
*/
public function generateSalt(): string
{
return bin2hex(random_bytes(32));
}
/**
* Generate a random encryption key (32 bytes, returned as hex).
*/
@@ -207,60 +199,6 @@ class FileEncryptionService
return $plaintext;
}
/**
* Encrypt a file on the server in the `SEALCHK2` format.
*/
public function encryptFile(string $sourcePath, string $destPath, string $key, int $chunkSize): void
{
$source = fopen($sourcePath, 'rb');
if ($source === false) {
throw new RuntimeException("Cannot read source file: {$sourcePath}");
}
$dest = fopen($destPath, 'wb');
if ($dest === false) {
fclose($source);
throw new RuntimeException("Cannot write encrypted file: {$destPath}");
}
try {
$header = $this->createHeader($chunkSize);
$noncePrefix = $this->parseHeader($header)['noncePrefix'];
$chunkCount = $this->chunkCount((int) filesize($sourcePath), $chunkSize);
fwrite($dest, $header);
for ($index = 0; $index < $chunkCount; $index++) {
$plaintext = (string) fread($source, $chunkSize);
fwrite($dest, $this->encryptChunk($plaintext, $key, $noncePrefix, $index, $index === $chunkCount - 1));
}
} catch (RuntimeException $e) {
fclose($source);
fclose($dest);
@unlink($destPath);
throw $e;
}
fclose($source);
fclose($dest);
}
/**
* Stream decrypted file content directly to output (echo).
*/
public function streamDecryptedFile(string $encryptedPath, string $key): void
{
foreach ($this->decryptedChunks($encryptedPath, $key) as $chunk) {
echo $chunk;
flush();
}
}
/**
* The decrypted content of a file in any of the three formats, chunk by chunk.
*