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
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:
parent
a37895a16a
commit
f1202bea08
226 changed files with 1952 additions and 450 deletions
|
|
@ -61,7 +61,7 @@ class PluginAssets
|
|||
|
||||
$this->cache[$slug] = [
|
||||
'base' => '/plugin-assets/'.rawurlencode($slug).'/'.rawurlencode($manifest->version).'/',
|
||||
'components' => array_filter(array_map($clean, (array) ($data['components'] ?? []))),
|
||||
'components' => array_filter(array_map($clean, (array) ($data['components'] ?? [])), fn ($file, $key) => $file !== null && preg_match('#^[A-Za-z0-9_/-]+$#', (string) $key), ARRAY_FILTER_USE_BOTH),
|
||||
'css' => array_values(array_filter(array_map($clean, (array) ($data['css'] ?? [])))),
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,10 @@ class PluginInstaller
|
|||
return ! filter_var(config('inhaus.disallow_file_mods'), FILTER_VALIDATE_BOOL);
|
||||
}
|
||||
|
||||
public function install(string $zipFile): PluginManifest
|
||||
/**
|
||||
* @param string|null $expectedSlug bei Updates: das Archiv muss genau dieses Plugin enthalten
|
||||
*/
|
||||
public function install(string $zipFile, ?string $expectedSlug = null): PluginManifest
|
||||
{
|
||||
if (! self::uploadsAllowed()) {
|
||||
throw new RuntimeException('Das Installieren von Plugins ist in dieser Installation abgeschaltet.');
|
||||
|
|
@ -42,6 +45,10 @@ class PluginInstaller
|
|||
throw new RuntimeException('Das Archiv enthält kein gültiges Plugin: '.$e->getMessage());
|
||||
}
|
||||
|
||||
if ($expectedSlug !== null && $manifest->slug !== $expectedSlug) {
|
||||
throw new RuntimeException("Das Archiv enthält das Plugin „{$manifest->slug}“ statt „{$expectedSlug}“.");
|
||||
}
|
||||
|
||||
$existing = $this->plugins->find($manifest->slug);
|
||||
|
||||
if ($existing?->core) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue