From a064f5b46189cbe01b545cc72f38b5e615354afc Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 18 May 2026 23:39:43 +0000
Subject: [PATCH 1/9] Initial plan
From 03e73754253d9e13740d24440b55a156262b46fd Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 18 May 2026 23:50:48 +0000
Subject: [PATCH 2/9] fix(security): add OAuth state validation and CSRF
protection across POST forms
Agent-Logs-Url: https://github.com/marpisco/ClassLink/sessions/915c369e-d638-4384-89f9-6bf45604b511
Co-authored-by: marpisco <162377105+marpisco@users.noreply.github.com>
---
admin/index.php | 34 ++++++++++++++++++++++++++++++++++
admin/relatorios.php | 6 ++++++
login/index.php | 40 +++++++++++++++++++++++++++++++++-------
reservar/index.php | 7 +++++++
reservar/manage.php | 8 +++++++-
src/db.php | 6 ++++--
6 files changed, 91 insertions(+), 10 deletions(-)
diff --git a/admin/index.php b/admin/index.php
index 9474fbc..3aa85da 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -13,6 +13,7 @@
Pedido inválido. Atualize a página e tente novamente.");
+ }
+ }
?>
";
+ $csrfTokenForJs = json_encode(generate_csrf_token());
+ echo "";
+
?>
";
+ echo csrf_token_field();
foreach ($inputs as $input) {
$id_safe = htmlspecialchars($input['id'], ENT_QUOTES, 'UTF-8');
$value_safe = htmlspecialchars($input['value'], ENT_QUOTES, 'UTF-8');
diff --git a/admin/relatorios.php b/admin/relatorios.php
index 3f1c9e8..4258cf8 100644
--- a/admin/relatorios.php
+++ b/admin/relatorios.php
@@ -1,11 +1,16 @@
Pedido inválido. Atualize a página e tente novamente.
");
+ }
if (!$_SESSION['admin']) {
http_response_code(403);
die("Não tem permissão para entrar no painel administrativo.
Voltar para a página inicial ");
@@ -161,6 +166,7 @@ public function Footer() {
Gere um relatório em PDF da utilização de salas para um dia específico.