Case study · Client work · 2026

Hardening a live Laravel site

Goal: make a live Laravel site safe to run, then move it onto a supported stack.

review / findings
criticalDebug mode on in production✓ fixed same day
highPublic route ran a server action✓ fixed same day
mediumUploads had no file type checks✓ rebuild
mediumOpen registration✓ rebuild
+3Contact form, validation, old stack✓ rebuild
7 findings · 7 closedPHP 8.1 → 8.3
7findings (1 critical, 1 high, 2 medium)
2worst fixed on the live site the same day
8.1 → 8.3PHP, in the Laravel 12 rebuild

The starting point

This site started as a Laravel 9 app on PHP 8.1. Both were past security support, and the content stopped at December 2022. Before changing anything I ran a read-only code review of the app.

What the review found

The review logged seven findings. The four security ones:

  • Critical: debug mode was on in production. Any error showed a full debug page with stack traces, config and request data, and the debug tool's helper routes were live.
  • High: a public route, with no login, ran a server-side file system action.
  • Medium: admin file uploads had no file type checks.
  • Medium: registration was open, so anyone could create an account.

The other three were a contact form that visitors could not use because it sat behind the admin login, missing validation on updates, and the end-of-life stack. The review also spotted credential files sitting in a web-served folder next to the site.

What got fixed and how

The two worst went live the same day. Debug mode came off, the log level dropped to errors, and the public route was deleted. I backed up both edited files first and wrote the rollback as a single command.

The rest went into a rebuild on Laravel 12 and PHP 8.3, built and tested on a password-protected staging copy before it touched the live site. The rebuild has no public registration, validates uploads, no longer ships the debug tooling or the route list in page source, and has a contact form that works for visitors. That form checks input, rate limits requests and carries a honeypot field. The credential files were moved out of the web-served folder, and both old URLs now return 404.

How the fixes were checked

After the same-day fixes I checked the live site from outside with curl. The removed route and the debug endpoints returned 404, an unknown URL showed no debug page, the admin area redirected to login and the home page still returned 200.

On staging, 37 browser checks passed, plus request checks. Registration returned 404, a POST without a CSRF token returned 419, and repeated contact posts hit a 429 on the fourth. After the switch to live, 36 of 36 browser checks passed again. The live checks also caught a response header that exposed the PHP version. It was removed and checked again.

Result

Seven findings, and the two worst fixed live on the day of the review. The site now runs Laravel 12 on PHP 8.3, with every code finding from the review addressed. The credential files are out of the web root and the old keys revoked.