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
|
|
@ -77,6 +77,11 @@ class Content
|
|||
|
||||
$type = $this->blocks->get($clean['type']);
|
||||
|
||||
// Blöcke eines Moduls, von dem die Person ausgeschlossen ist, auch in der Vorschau nicht berechnen
|
||||
if ($type && ! app(PluginAccess::class)->allows($type->key, $user)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $type?->resolve ? $this->resolve($type, $clean, $user, $context) : [];
|
||||
}
|
||||
|
||||
|
|
@ -133,8 +138,13 @@ class Content
|
|||
*
|
||||
* @param array<mixed>|null $content
|
||||
*/
|
||||
public function plainText(?array $content): string
|
||||
public function plainText(?array $content, bool $publicOnly = false): string
|
||||
{
|
||||
// Für Suche und Auszüge: Blöcke mit eingeschränkter Sichtbarkeit (und ihr Inhalt) weglassen
|
||||
if ($publicOnly && is_array($content)) {
|
||||
$content = ['blocks' => self::withoutRestricted($content['blocks'] ?? [])];
|
||||
}
|
||||
|
||||
$parts = $this->collect($content, function (array $block) {
|
||||
$texts = [];
|
||||
|
||||
|
|
@ -154,6 +164,29 @@ class Content
|
|||
return trim(preg_replace('/\s+/u', ' ', html_entity_decode(implode(' ', $parts))) ?? '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<mixed> $blocks
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
private static function withoutRestricted(array $blocks): array
|
||||
{
|
||||
$result = [];
|
||||
|
||||
foreach ($blocks as $block) {
|
||||
if (! is_array($block) || array_filter((array) ($block['visibility'] ?? []))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($block['items'])) {
|
||||
$block['items'] = array_map(fn ($item) => is_array($item) ? [...$item, 'blocks' => self::withoutRestricted((array) ($item['blocks'] ?? []))] : $item, (array) $block['items']);
|
||||
}
|
||||
|
||||
$result[] = $block;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ final class Field
|
|||
}
|
||||
|
||||
// Relative Adressen im Portal, Anker oder http(s)/mailto/tel – nichts anderes (kein javascript:).
|
||||
if (preg_match('#^(/(?!/)|\#)#', $url) || preg_match('#^(https?://|mailto:|tel:)#i', $url)) {
|
||||
if (preg_match('#^(/(?![/\\\\])|\#)#', $url) || preg_match('#^(https?://|mailto:|tel:)#i', $url)) {
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue