diff --git a/app/bootstrap.php b/app/bootstrap.php index b38b910..5b1414a 100644 --- a/app/bootstrap.php +++ b/app/bootstrap.php @@ -59,12 +59,13 @@ set_exception_handler(static function (Throwable $error): void { }); if (PHP_SAPI !== 'cli') { - security_headers(); // Öffentliche Rechtsseiten, Health-Check und Cron brauchen keine Session. // So wird auf Impressum/Datenschutz kein unnötiges Sitzungs-Cookie gesetzt. $path = current_path(); + $legalPublic = legal_is_public_path($path); + security_headers($legalPublic); $sessionFree = ['/health', '/cron/reminders']; - if (!legal_is_public_path($path) && !in_array($path, $sessionFree, true)) { + if (!$legalPublic && !in_array($path, $sessionFree, true)) { start_session(); } } diff --git a/app/util.php b/app/util.php index 59d95af..dcebbcb 100644 --- a/app/util.php +++ b/app/util.php @@ -23,11 +23,14 @@ function is_https(): bool return strtolower((string) ($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '')) === 'https'; } -function security_headers(): void +function security_headers(bool $indexable = false): void { header('X-Content-Type-Options: nosniff'); header('X-Frame-Options: DENY'); - header('X-Robots-Tag: noindex, nofollow, noarchive'); + // Impressum/Datenschutz bleiben abrufbar; alles andere ist eine private App. + if (!$indexable) { + header('X-Robots-Tag: noindex, nofollow, noarchive'); + } header('Referrer-Policy: same-origin'); header('Permissions-Policy: camera=(), microphone=(), geolocation=()'); header( diff --git a/web/robots.txt b/web/robots.txt new file mode 100644 index 0000000..ec4644d --- /dev/null +++ b/web/robots.txt @@ -0,0 +1,7 @@ +# Drink it cold – Terminplanung +# Die App selbst ist nicht öffentlich; nur die Pflichtseiten dürfen +# abgerufen werden (Links, Vorschauen, Suchmaschinen). +User-agent: * +Allow: /impressum +Allow: /datenschutz +Disallow: /