[FINAL REVIEW] Complete security review — CSRF, prepared statements, transactions, merge with main#149
Conversation
|
@copilot |
…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>
Agent-Logs-Url: https://github.com/marpisco/ClassLink/sessions/915c369e-d638-4384-89f9-6bf45604b511 Co-authored-by: marpisco <162377105+marpisco@users.noreply.github.com>
Agent-Logs-Url: https://github.com/marpisco/ClassLink/sessions/915c369e-d638-4384-89f9-6bf45604b511 Co-authored-by: marpisco <162377105+marpisco@users.noreply.github.com>
…h matching Agent-Logs-Url: https://github.com/marpisco/ClassLink/sessions/915c369e-d638-4384-89f9-6bf45604b511 Co-authored-by: marpisco <162377105+marpisco@users.noreply.github.com>
Agent-Logs-Url: https://github.com/marpisco/ClassLink/sessions/915c369e-d638-4384-89f9-6bf45604b511 Co-authored-by: marpisco <162377105+marpisco@users.noreply.github.com>
… audit ids Agent-Logs-Url: https://github.com/marpisco/ClassLink/sessions/915c369e-d638-4384-89f9-6bf45604b511 Co-authored-by: marpisco <162377105+marpisco@users.noreply.github.com>
…ction Agent-Logs-Url: https://github.com/marpisco/ClassLink/sessions/915c369e-d638-4384-89f9-6bf45604b511 Co-authored-by: marpisco <162377105+marpisco@users.noreply.github.com>
Implementei os pontos pedidos: validação de |
|
As per new feature that was implemented (Importação Massiva de Reservas por CSV #152), "Post-merge follow-ups (not blocking, but recommended): Add CSRF protection to remaining materiais.php actions (criar, criar_completo, update, apagar) — currently unprotected Remember to implement all of this later on. |
…ty-backend - Resolved conflict in admin/relatorios.php: kept both CSRF validation (ours) and pending TOTP/setup flow guards (main) - Auto-merged: admin/index.php, login/index.php, reservar/index.php, reservar/manage.php — all security additions from both sides preserved
|
📝 Manual Update Required? It looks like you've modified core logic. Please check if the user manual needs a refresh! @marpisco |
…atements, transactions - materiais.php: Convert apagar action from GET to POST with CSRF token; add explicit CSRF token fields to criar_completo and update forms - reservaemmassa.php: Add transaction wrapper (begin/commit/rollback) to CSV import and mass reservation loops for atomicity; add explicit CSRF token to mass reservation form; use separate insertErrorCount to avoid rollback on validation-only errors - reservar/manage.php: Replace all $db->query() with real_escape_string() (6 occurrences) with prepared statements per coding rules
4619637 to
549d983
Compare
|
📝 Manual Update Required? It looks like you've modified core logic. Please check if the user manual needs a refresh! @marpisco |
Security review completed — all items addressedFrom @marpisco's follow-up (post #152 merge):
Additional findings & fixes from re-review:
Merge status
Ready for final review. |
This pass implements the security fixes identified in the original review, the follow-up items from PR #152 (CSV import), and a comprehensive re-review of all overlapping files after merging with
main.Changes implemented
OAuth & CSRF (original scope)
statevalidation enforced — validates$_GET['state']against$_SESSION['oauth2state']withhash_equals(); rejected attempts logged with audit contextcsrf_token_field()on all formserror_log()server-side, return generic user-facing messagePost-merge review & new features (follow-up from #152)
materiais.phpapagaraction: GET → POST with CSRF — destructive deletion was a plain GET link; converted to POST form withcsrf_token_field()criar_completo,update, and mass reservation forms now have explicitcsrf_token_field()for defense-in-depth$db->begin_transaction()/ commit / rollback on both loops; separate$insertErrorCountavoids rolling back on validation-only errors$db->query()withreal_escape_string()→ prepared statements — 6 occurrences inreservar/manage.phpreplaced with$db->prepare()+bind_param()per coding rulesMain branch merge
maininto branch, resolved conflict inadmin/relatorios.php(kept both CSRF validation and pending TOTP/setup flow guards)Already verified (no changes needed)
salas_search.php&tempos_search.php— LIKE wildcard escaping already present (fixed in Adicionar importação de reservas em massa via CSV com modal de pesquisa de IDs no painel admin #152)requisitor_lookup,sala_lookup,tempo_lookup) — properly secured with auth guards, wildcard escaping, prepared statementspost_reservation_contentfrom CKEditor intentionally kept as raw HTML (admin-controlled rich content)Merge status
main(b748299)php -l