scheb/2fa-trusted-device
Adds trusted device support to scheb/2fa so users can skip 2FA on recognized devices for a set time. Stores trust tokens in cookies and persistence, with configurable lifetimes and validation, improving UX without removing 2FA security.
scheb/2fa-trusted-device package extends the scheb/2fa-bundle by adding trusted device management (e.g., auto-login for recognized devices, device whitelisting). This aligns well with security-sensitive Laravel applications (e.g., SaaS platforms, financial apps, or admin dashboards) where 2FA is mandatory but UX friction must be balanced.scheb/2fa-bundle for TOTP/HOTP). Minimal architectural disruption if the base 2FA system is already in place.scheb/2fa-bundle (v5+ recommended). If not already used, this adds ~10–15 hours of setup (TOTP/HOTP integration, config, middleware).auth system but may need adjustments for custom guard implementations (e.g., API tokens).trusted_devices (device fingerprint, user association, expiry). Migration-friendly if using Laravel’s schema builder.trusted_device_lifetime, ip_whitelist). Can be environment-agnostic (e.g., .env overrides).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| 2FA Bundle Version Mismatch | High | Pin scheb/2fa-bundle to a stable version (e.g., ^5.0). Test against Laravel 10+ early. |
| Device Fingerprinting Collisions | Medium | Validate fingerprint uniqueness in tests. Use hash() for storage. |
| Session Hijacking | Medium | Combine with laravel-session middleware to invalidate sessions on device changes. |
| Performance Impact | Low | Device checks are O(1) (DB index on user_id). Cache TrustedDevice model if high traffic. |
scheb/2fa-bundle?
user_agent + IP. For mobile apps, may need custom fingerprinting (e.g., device ID).tenancy, verify the package’s user_id scoping works across tenants.laravel/framework:^10.0 for compatibility.web guard.api guard.scheb/2fa-bundle and configure TOTP/HOTP.php artisan vendor:publish --tag=2fa-trusted-device-config).php artisan migrate).HandleIncomingInertiaRequests for Inertia.js apps).TrustedDevice model for fingerprint validation.TrustedDevice checks run before permission gates.TrustedDevice model uses cache tags to invalidate on device changes.config or Envoyer flags to toggle trusted device logic in staging.scheb/2fa-bundle for breaking changes (e.g., v6.0+ may drop PHP 8.0 support).pest/phpunit suites.TrustedDevice model if additional fields are needed (e.g., device_name, last_seen_at).TrustedDeviceService for custom fingerprinting (e.g., include Accept-Language header).user_id. No scaling issues expected.TrustedDevice queries in Redis (e.g., Cache::remember).trusted_devices table may grow with user base. Archive old devices via partitioning (e.g., by created_at).| Scenario | Impact | Mitigation |
|---|---|---|
| Database Downtime | Users locked out | Fallback to manual 2FA bypass (admin-only). |
| Fingerprint Collision | False rejections | Implement grace period (e.g., 5 mins) for manual override. |
| Session Fixation | Account takeover | Bind trusted devices to session ID (not just IP/user-agent). |
| Package Bug | Broken auth flow | Maintain a local fork for critical fixes. |
user_agent/IP changes affect stability.How can I help you explore Laravel packages today?