Skip to content

v2.4.0 — secure-by-default redaction and MariaDB repair release

Latest

Choose a tag to compare

@ahmed-merza ahmed-merza released this 04 Nov 05:46

Redaction gaps closed, MariaDB < 10.10 support fixed, and an opt-in minimum
level for capture-all mode. Has a migration — run php artisan migrate.
It changes nothing on MySQL 8, MariaDB 10.10+, Postgres or SQLite.

Upgrading

  • The migration only touches an install that already has the bug (MariaDB before 10.10 or MySQL 5.7, with explicit_defaults_for_timestamp off). There it changes the column type, which MySQL and MariaDB do by copying the whole table: log_entries is locked for writes until the copy finishes, so on a large table new log writes wait for that long. Prune first (php artisan logscope:prune) and run it off-peak. Everywhere else it reads the schema and returns.
  • If you published LogScope's migrations, your copies keep their old content — a published file with the same name replaces the package's. On MariaDB before 10.10 in strict mode the old 2026_09_23_000001 copy still fails with Invalid default value for 'last_seen_at' before the repair can run. Republish with php artisan vendor:publish --tag=logscope-migrations --force (this overwrites every published LogScope migration, so re-apply any edits you made), or change timestamp(...) to dateTime(...) for occurred_at, first_seen_at and last_seen_at in your copies. With LOGSCOPE_MIGRATIONS_ENABLED=false the repair migration only runs once published.
  • More fields now read [REDACTED]. cookie, session and xsrf match as a fragment inside a key, so harmless-looking fields such as cookie_consent, cookies_accepted, session_count, session_lifetime, sessions, xsrf_enabled and possession are redacted in new entries. Name any you need in context.sensitive_keys_except to keep them; php artisan logscope:doctor shows what is redacted.

Security

  • A header bag logged as an array kept the session cookie and the Basic-auth password. Log::info('…', ['headers' => $request->headers->all()]) is matched by sensitive_keys, not sensitive_headers, and none of cookie, set-cookie, x-xsrf-token or php-auth-pw (which splits into php/auth/pw) matched a default key. cookie, session, xsrf and php_auth_pw are now default keys. Because keys match as a fragment inside a word, fields such as session_count or cookie_consent now read [REDACTED] too; name them in sensitive_keys_except to keep them.
  • The Referer header was stored with its query string. referer is in the default header allowlist, so a page's ?token=… reached the headers column. Its query now goes through sensitive_keys like the entry's own url, keeping the origin, path and other parameters; a relative (/cb?token=…) or scheme-less Referer is redacted too. This also applies to a logged Request's headers, and to a header or server bag logged as an array ($request->headers->all(), $request->server->all()): the query in a referer, HTTP_REFERER, REQUEST_URI or QUERY_STRING key is redacted the same way. Other URL-looking keys, such as your own url, are left as logged. code is not a default key (it would blank status_code, country_code), so an OAuth server should add it to sensitive_keys to cover ?code= in both the url and the Referer.

Fixed

  • MariaDB before 10.10: occurred_at changed on every update, and log_groups could not be created. With explicit_defaults_for_timestamp off (the default before MariaDB 10.10, and on MySQL 5.7) the server gave log_entries.occurred_at ON UPDATE CURRENT_TIMESTAMP, so a status change, note or fingerprint backfill overwrote when the log happened; the 2.3.0 migration then failed with Invalid default value for 'last_seen_at'. New installs create these columns as datetime. The new migration repairs occurred_at, first_seen_at and last_seen_at only where the server gave them a default, which rebuilds those tables once; healthy installs are left alone. A failed 2.3.x migration now completes on the next migrate. Times already overwritten can't be recovered.

Added

  • ignore.min_level (LOGSCOPE_MIN_LEVEL). Capture-all mode reads every log the app writes, so your channels' LOG_LEVEL never applied and Log::debug() filled the table. Set LOGSCOPE_MIN_LEVEL=info, or "${LOG_LEVEL}" to follow your channels. Unset by default, so nothing changes on upgrade. Takes a level name, a Monolog value (200) or a Monolog\Level. An unknown one is reported to error_log and filters nothing.