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

@ -41,17 +41,20 @@ final class SvgSanitizer
$xpath = new DOMXPath($dom);
foreach (iterator_to_array($xpath->query('//*[local-name()="script" or local-name()="foreignObject" or local-name()="iframe" or local-name()="object" or local-name()="embed"]')) as $node) {
// Auch Animationen (set/animate) – sie können Links nachträglich auf javascript: setzen.
foreach (iterator_to_array($xpath->query('//*[local-name()="script" or local-name()="foreignObject" or local-name()="iframe" or local-name()="object" or local-name()="embed" or local-name()="set" or starts-with(local-name(), "animate") or local-name()="handler" or local-name()="listener"]')) as $node) {
$node->parentNode->removeChild($node);
}
foreach (iterator_to_array($xpath->query('//*')) as $element) {
/** @var DOMElement $element */
foreach (iterator_to_array($element->attributes) as $attribute) {
$name = strtolower($attribute->nodeName);
$name = strtolower($attribute->localName ?? $attribute->nodeName);
$value = strtolower(preg_replace('/\s+/', '', $attribute->nodeValue));
if (str_starts_with($name, 'on') || (in_array($name, ['href', 'xlink:href', 'src'], true) && ! str_starts_with($value, '#') && ! str_starts_with($value, 'data:image/'))) {
$dangerous = str_contains($value, 'javascript:') || str_contains($value, 'vbscript:') || str_contains($value, 'data:text') || str_contains($value, 'expression(');
if (str_starts_with($name, 'on') || $dangerous || (in_array($name, ['href', 'src'], true) && ! str_starts_with($value, '#') && ! str_starts_with($value, 'data:image/'))) {
$element->removeAttributeNode($attribute);
}
}