diff --git a/app/Controllers/AutoriController.php b/app/Controllers/AutoriController.php
index 556fa391a..8f277d514 100644
--- a/app/Controllers/AutoriController.php
+++ b/app/Controllers/AutoriController.php
@@ -392,8 +392,19 @@ public function delete(Request $request, Response $response, mysqli $db, int $id
session_start();
}
$_SESSION['error_message'] = __('Impossibile eliminare l\'autore: sono presenti libri associati.');
+ // Only bounce back to the referring authors page when it is a
+ // same-host /admin/authors URL — a bare substring check would let
+ // https://evil.tld/admin/authors through as an open redirect.
$referer = $request->getHeaderLine('Referer');
- $target = str_contains($referer, '/admin/authors') ? $referer : '/admin/authors';
+ $target = url('/admin/authors');
+ if ($referer !== '' && strpbrk($referer, "\r\n") === false && !str_starts_with($referer, '//')) {
+ $parsed = parse_url($referer);
+ $host = $parsed['host'] ?? null;
+ $sameHost = $host === null || $host === ($_SERVER['HTTP_HOST'] ?? '');
+ if ($sameHost && str_contains((string) ($parsed['path'] ?? ''), '/admin/authors')) {
+ $target = $referer;
+ }
+ }
return $response->withHeader('Location', $target)->withStatus(302);
}
diff --git a/app/Controllers/FrontendController.php b/app/Controllers/FrontendController.php
index 3bd75791d..3bd876a0f 100644
--- a/app/Controllers/FrontendController.php
+++ b/app/Controllers/FrontendController.php
@@ -377,10 +377,11 @@ public function home(Request $request, Response $response, mysqli $db, ?Containe
$orgSchema['sameAs'] = $sameAs;
}
- // Combine schemas
- $seoSchema = json_encode([$schemaOrg, $orgSchema], JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);
+ // Combine schemas. JSON_HEX_TAG neutralises any that could
+ // reach the value (defence in depth on top of the strip_tags at save).
+ $seoSchema = json_encode([$schemaOrg, $orgSchema], JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_HEX_TAG);
} else {
- $seoSchema = json_encode($schemaOrg, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);
+ $seoSchema = json_encode($schemaOrg, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_HEX_TAG);
}
// Render template
diff --git a/app/Views/frontend/home-sections/latest_books_title.php b/app/Views/frontend/home-sections/latest_books_title.php
index 94e6f2ea9..30d5d94b5 100644
--- a/app/Views/frontend/home-sections/latest_books_title.php
+++ b/app/Views/frontend/home-sections/latest_books_title.php
@@ -27,7 +27,7 @@
= __("Carica Altri") ?>
-
+
= __("Visualizza Tutto il Catalogo") ?>
diff --git a/app/Views/layout.php b/app/Views/layout.php
index ad840572c..2a1c27e08 100644
--- a/app/Views/layout.php
+++ b/app/Views/layout.php
@@ -1318,7 +1318,7 @@ function initializeDropdowns() {
${escapeHtml(notif.message || '')}
${hasLink ? `
-
+