I've added security audit logging to my Laravel React Starter Kit (i18n edition).
Built with
Only users whose verified email addresses appear in
spatie/laravel-activitylog, it records the following security events:
- Login: failed attempts
- Password changes and resets: success and failure
- MFA: enabled, disabled, failed attempts, and recovery code regeneration
- Passkeys: registration and deletion
- Email changes: success and failure
- Account deletion: success and failure
For operations where an event being dispatched doesn't necessarily mean success, the implementation checks whether the change was actually persisted.
Sensitive data such as passwords, tokens, recovery codes, and email address values is excluded from the audit log.
Events are stored in a dedicated security activity log. Normal Eloquent update and delete operations are blocked for these records, and old entries are removed through scheduled retention cleanup.
Administrative access is still a temporary solution.
The Starter Kit doesn't currently have administrator roles or a management UI. Instead, authorized email addresses and log retention are configured in config/audit.php through environment variables:
dotenv
AUDIT_SECURITY_RETENTION_DAYS=365 AUDIT_SECURITY_VIEWERS=admin@example.com,security@example.com
AUDIT_SECURITY_VIEWERS can access /admin/security-events. If the list is empty, nobody has access.
The endpoint returns read-only JSON, with filtering and pagination. There's no dedicated UI yet, but a simple viewer could be built using something like react-json-view-lite.
Ideally, audit log access should eventually be managed through a proper role and permission system.
However, whether a general-purpose Starter Kit should include a full administration system by default is a separate question. I may explore administrator roles, permissions, and a management UI in a separate branch.
For now, the goal is to establish a foundation for recording and investigating security events without turning the Starter Kit into a full administration framework.
https://github.com/catatsumuri/react-starter-kit-i18n/pull/10I've added session management to my Laravel React Starter Kit (i18n edition).
Users can now view their active sessions and:
- Revoke an individual session
- Sign out all other devices
- Revoke every session, including the current one
The implementation also invalidates…
GitHubSession revocation by catatsumuri · Pull Request #9 · catatsumuri/react-starter-kit-i18nSummary Brings in security/session-revocation: lets a user view their active sessions and revoke a single session, all other sessions, or every session (including "remember me" logins), ...
GitHubSecurity event logging (activity log) by catatsumuri · Pull Request #10 · catatsumuri/react-starter-kit-i18nSummary Brings in security/event-log: records security-relevant actions (password change/reset, MFA enable/disable/recovery-codes, passkey add/remove, email change, account deletion) and their rej...
commit 9eed5b9