← All topics

#security

3 min read

Laravel exists and unique Rules: Two Advisories and How to Validate Safely

Laravel published two moderate advisories for laravel/framework on 18 Nov 2026: Rule::exists()/Rule::unique() fluent where() values can be read as predicates, and exists can be bypassed by integer or boolean JSON input on MySQL/MariaDB. Upgrade to 12.73.0 or 13.43.0, add string rules before exists/unique, and keep independent ownership checks.

4 min read

Logging Without Leaking Secrets or PII in PHP and Laravel

Do not log $request->all(), Authorization headers, cookies or passwords. Use Laravel's Log facade with a request id from Log::withContext() or shareContext(), and run context arrays through a redaction helper before writing them. Logs are often copied to Slack, files and log vendors — a secret in a log is a secret out of your app.

4 min read

Keeping Secrets Out of Git: .env, APP_KEY and APP_DEBUG

Laravel's documentation says the .env file should not be committed to source control. Keep APP_KEY and database credentials in the environment, set APP_DEBUG to false in production, and after config:cache only call env() from config files. If you need a file in git, use php artisan env:encrypt and store the decryption key in a password manager.

4 min read

PHP Deserialization Risks: Why unserialize Is Unsafe for User Input

The PHP manual warns: do not pass untrusted input to unserialize(), regardless of allowed_classes. Unserialization can instantiate objects and run code during autoloading. Prefer json_encode() / json_decode() for data you accept from users, and treat allowed_classes as a hardening step for trusted payloads only.

4 min read

WordPress Nonces and Capability Checks: CSRF Is Not Authorization

WordPress nonces help prevent CSRF, but they are not one-time tokens and they are not authorization. Verify a nonce with check_admin_referer() or wp_verify_nonce(), and separately call current_user_can() in the request handler. Official documentation says you should always assume a nonce can be compromised.

4 min read

Signed URLs in Laravel: signedRoute, Expiry and the signed Middleware

Laravel signed URLs append an HMAC to the query string so the path and query cannot be altered unnoticed. Prefer URL::temporarySignedRoute() with an expiry, protect the route with the signed middleware, and read parameters with $request->query() because the request body is not signed.

4 min read

Encryption in Laravel and PHP: Crypt, APP_KEY and sodium

Laravel's Crypt::encryptString() uses OpenSSL AES-256-CBC and signs every value with a MAC. Generate APP_KEY with php artisan key:generate, never commit it, and use APP_PREVIOUS_KEYS when you rotate. In plain PHP, use the sodium extension's documented secretbox API rather than a home-grown cipher.

4 min read

Auditing PHP Dependencies with composer audit

Run composer audit (and composer audit --locked in CI) against the Packagist advisory API. The command exits 0 when it finds no issues and 1 when packages match a policy, including security advisories, abandoned packages or malware flags. composer update already runs an audit unless you pass --no-audit.

4 min read

Path Traversal in PHP and Laravel: Safe File Paths

Never concatenate request input onto a filesystem path. Reject null bytes, backslashes and absolute paths, resolve the result with realpath(), and allow the file only when it stays inside a known base directory. realpath() returns false when the path does not exist, so new files need a parent-directory check.

4 min read

SSRF in PHP HTTP Clients: Don't Fetch User-Supplied URLs

SSRF happens when your server fetches a URL an attacker chose. Don't pass request input to file_get_contents(), cURL or Laravel's Http::get(). Allow-list the hosts you intend to call, require HTTPS, reject URLs with credentials, and disable redirects.

4 min read

Rate Limiting Login in Laravel: throttle, RateLimiter and Fortify

Define named Laravel rate limiters with RateLimiter::for() and Limit::perMinute()->by(), attach them with the throttle middleware (HTTP 429 when exceeded), and keep Fortify's default login throttle: 5 attempts per 60 seconds, keyed by username and IP.

4 min read

Open Redirects in PHP and Laravel: Validating ?next= and Return URLs

Laravel's redirect()->to() returns full URLs like https://evil.example or //evil.example unchanged, so redirect($request->input('next')) is an open redirect. Accept only single-slash local paths (or an explicit host allowlist), reject backslashes and control characters, and fall back to a safe default.

Get new briefs by email

Short alerts when a PHP or WordPress vulnerability needs action.

Double opt-in via Buttondown; unsubscribe any time. See our privacy policy.