Sicherheitsupdate nach Audit (0.29.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 7m50s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 7m34s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 5m45s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 5m30s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 7m7s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 7m9s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 6m8s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 6m5s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 48s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m5s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-27 11:34:54 +00:00
parent a37895a16a
commit f1202bea08
226 changed files with 1952 additions and 450 deletions

View file

@ -3,6 +3,7 @@
namespace App\Plugins;
use App\Support\Audit;
use App\Support\SafeOutbound;
use App\Support\Settings;
use App\Version;
use Illuminate\Support\Facades\Artisan;
@ -102,7 +103,16 @@ class PluginUpdates
$file = tempnam(sys_get_temp_dir(), 'plugin-update');
try {
$response = Http::timeout(120)->withOptions(['sink' => $file])->get($this->safeUrl($info['download_url']));
// Nur über HTTPS (auch bei Weiterleitungen), nie an interne Adressen, Größe schon beim Laden begrenzen
$response = Http::timeout(120)->withOptions([
...SafeOutbound::options(['https']),
'sink' => $file,
'progress' => function ($total, $downloaded) {
if ($total > self::MAX_BYTES || $downloaded > self::MAX_BYTES) {
throw new RuntimeException('Das Update ist größer als 50 MB.');
}
},
])->get($this->safeUrl($info['download_url']));
if (! $response->successful()) {
throw new RuntimeException("Download fehlgeschlagen (HTTP {$response->status()}).");
@ -117,11 +127,7 @@ class PluginUpdates
}
$wasEnabled = $this->plugins->isEnabled($slug);
$manifest = $this->installer->install($file);
if ($manifest->slug !== $slug) {
throw new RuntimeException("Das Archiv enthält das Plugin „{$manifest->slug}“ statt „{$slug}“.");
}
$manifest = $this->installer->install($file, expectedSlug: $slug);
// Neue Tabellen oder Spalten des Plugins sofort anlegen
if ($wasEnabled && is_dir($manifest->migrationsPath())) {
@ -141,7 +147,7 @@ class PluginUpdates
*/
private function fetch(string $url): array
{
$response = Http::timeout(15)->acceptJson()->get($this->safeUrl($url));
$response = Http::timeout(15)->acceptJson()->withOptions(SafeOutbound::options(['https']))->get($this->safeUrl($url));
if (! $response->successful()) {
throw new RuntimeException("Update-Adresse antwortet mit HTTP {$response->status()}.");
@ -193,6 +199,10 @@ class PluginUpdates
throw new RuntimeException('Update-Adressen müssen mit https:// beginnen.');
}
if (! SafeOutbound::isPublicUrl($url, ['https'])) {
throw new RuntimeException('Update-Adressen dürfen nicht auf interne Server zeigen.');
}
return $url;
}
}