Skip to content

v1.2.2 — Security Patch: CSRF Protection, Debug File Removal, Auth Fixes

Choose a tag to compare

@TheTractorHacker TheTractorHacker released this 16 May 00:30
· 96 commits to main since this release

FoleyTimePro v1.2.2 — Security Patch

🔴 Critical — Deleted publicly accessible debug files

Three test/debug files were reachable at public URLs with no authentication:

File Risk
test_db.php Hardcoded DB password in plaintext — anyone could visit the URL and see SecureNet25! and full connection output
api/test_api.php Exposed JWT key infrastructure and token generation without auth
api/test_notifications.php Exposed push notification service internals without auth

All three files have been deleted from both the server and the repository.


🔴 High — CSRF protection added to all 26 admin POST forms

All admin forms that mutate data (create/edit/delete users, admins, shifts, offices, settings, exports, time-off) previously had no cross-site request forgery protection.

Implementation:

  • admin/includes/csrf.php — new helper providing csrf_field() (outputs a hidden token input) and csrf_valid() (validates with constant-time hash_equals)
  • admin/includes/header.php — automatically loads the CSRF helper on every admin page render
  • Every <form method="POST"> now includes <?= csrf_field() ?>
  • Every POST handler now validates with csrf_valid() before processing — returns HTTP 403 on failure

Note: All session cookies are already set with SameSite=Strict, which independently mitigates CSRF for modern browsers. This adds defense-in-depth.


🟠 High — Two more admin pages were missing session auth

  • admin/export_summary_pdf.php — no $_SESSION['admin'] check; also had display_startup_errors = 1
  • admin/test_timeoff.php — no $_SESSION['admin'] check

Both now return HTTP 403 to unauthenticated requests.


🟡 Service Worker cache version bumped v1.0.2 → v1.1.0

Forces all browsers to discard stale cached assets and re-fetch, picking up the corrected FoleyTimePro-logo.png / FoleyTimePro-favicon.webp image paths fixed in v1.2.1.