-
v0.4.0 Stable
released this
2026-05-15 17:15:48 +00:00 | 611 commits to master since this releaseTorvian Chatbot v0.4.0
Release Date: May 15, 2026
🔐 Security & Authentication Overhaul
This major release introduces comprehensive security enhancements to Torvian chatbot, featuring device trust management, multi-device session verification, email-based verification flows, and security alert mechanisms. The authentication architecture has been significantly refactored for better maintainability and extensibility.
What's New
🛡️ Device Trust & Security
- Device Identity Tracking: Each client device gets a persistent identifier for security purposes
- Account Security Modes: Choose between disabled, warning, or strict security levels
- Unrecognized Device Alerts: Users are notified of login attempts from new devices with verification requirements
- Trusted Device Management: Users can view and revoke previously trusted devices
- Device-Based IP Tracking: Session IP addresses are recorded for suspicious activity detection
📧 Email Verification Flows
- Device Verification Email: Unrecognized devices receive an email verification link
- Email Change Support: Users can change their account email address securely
- SMTP Configuration: Full SMTP support with TLS/auth for email delivery
- Email Validation: Email format and ownership validation before account changes
🔑 Enhanced Password & Session Management
- Configurable Auth Policies: Server-enforced username and password validation rules
- Required Password Changes: Force users to change passwords when needed
- Failed Login Protection: Sliding-window lockout after too many failed login attempts
- Session Management: List active sessions, revoke specific sessions, or logout all sessions at once
- Password-Protected Operations: Current password verification for sensitive account changes
- Restricted Session Mode: Unverified devices have limited capabilities until verified
🚨 Security Alerts & Resolution
- Login Alerts: See all unrecognized device attempts that triggered verification
- Trust or Dismiss: Users can acknowledge alerts to mark devices as trusted or dismiss them
- Restricted Actions: Blocked session operations from unverified devices to prevent accidental damage
- Permission Enforcement: Consistent authorization checks across all account operations
🔄 Architecture Improvements (Backend)
- Service Layer Refactoring: Split monolithic
AuthenticationServiceinto focused services:TokenService- JWT and refresh token managementDeviceTrustService- Device trust and verificationSecurityAuditService- Audit record managementAccountManagementService- User account operations
- ViewModel Refactoring: Split authentication flow into focused ViewModels for better state management
- Error Handling: Structured API error codes instead of fragile string matching
📊 Feature Details
User-Facing Features
- ✅ View and manage active sessions from device
- ✅ Revoke access from other sessions without logging out
- ✅ Logout all sessions at once
- ✅ Change email address securely
- ✅ Change password with current password verification
- ✅ View security alerts for unrecognized logins
- ✅ Trust or dismiss security alerts
- ✅ Review and remove trusted devices
- ✅ Forced password change flow for admin-triggered resets
- ✅ Clipboard-friendly device ID sharing
Server-Side Features
- ✅ Device verification token lifecycle management
- ✅ Rate-limited verification attempts
- ✅ Single-use verification tokens (one-time links)
- ✅ SMTP-based email notifications
- ✅ Reverse proxy configuration support (for X-Forwarded-For headers)
- ✅ Configurable security modes per environment
- ✅ Public authentication policy endpoint for client validation rules
- ✅ Audit trails for all device and session activities
- ✅ Database migrations for all new security tables
API Additions
Session & Device Management:
GET /api/v1/auth/sessions- List active sessionsDELETE /api/v1/auth/logout?sessionId={id}- Revoke specific sessionPOST /api/v1/auth/logout-all- Logout all sessionsGET /api/v1/auth/trusted-devices- List trusted devicesDELETE /api/v1/auth/trusted-devices/{deviceId}- Revoke trusted device
Device Verification (Authenticated):
POST /api/v1/auth/request-device-verification- Request verification email for current session
Device Verification (Public):
GET /api/v1/public/auth/verify-device?token={token}- Verify device via email link (returns HTML success/failure page)POST /api/v1/public/auth/request-device-verification- Public endpoint for users in STRICT mode without verified device
Security & Account (Authenticated):
GET /api/v1/auth/security-alerts- Retrieve unrecognized login alertsPOST /api/v1/auth/security-alerts/{alertId}/resolve- Trust/dismiss alertPOST /api/v1/auth/change-password- Change passwordPOST /api/v1/auth/complete-required-password-change- Forced password change completionPOST /api/v1/auth/change-email- Change email addressGET /api/v1/auth/policy- Fetch account validation policy (public)
⚙️ Configuration Changes
New Configuration Options
Account Security & Authentication:
{ "accountSecurityMode": "WARNING", "authPolicy": { "passwordConfig": { "minLength": 8, "maxLength": 128, "requireLowercase": true, "requireUppercase": true, "requireDigit": true, "requireSpecialChar": true, "checkCommonPasswords": true }, "usernameConfig": { "minLength": 3, "maxLength": 50, "allowedRegexPattern": "^[a-zA-Z0-9_-]+$" }, "maxFailedAttempts": 10, "lockoutWindowMinutes": 5 } }Note:
maxFailedAttemptsis the maximum failed login attempts allowed withinlockoutWindowMinutesbefore the account is temporarily locked.accountSecurityModeaccepts:DISABLED,WARNING, orSTRICT.Email Verification:
{ "email": { "provider": "smtp", "fromAddress": "noreply@example.com", "properties": { "host": "smtp.example.com", "port": "587", "user_env": "SMTP_USER", "password_env": "SMTP_PASSWORD", "auth": "true", "starttls": "true", "mail.smtp.ssl.trust": "smtp.example.com" } }, "serverUrl": "https://chatbot.example.com" }Note: Sensitive SMTP credentials should be provided via environment variables (prefixed with
_envsuffix) or in a separatesecrets.jsonfile, not in the main config.Reverse Proxy:
{ "reverseProxy": { "enabled": false, "proxyCount": 1, "useXForwardedHeaders": true, "useForwardedHeaders": false } }Note: Enable
reverseProxy.enabledand setproxyCountto match the number of proxies in front of your server (e.g., 1 for Caddy/Nginx). SetuseForwardedHeadersto false for security unless your proxy explicitly overwrites this header.Migration Guide
For Self-Hosted Deployments
-
Update Configuration Files
- Copy new settings from
application.example-local.jsonorapplication.example-vps.json - Set
accountSecurityModeto match your deployment profile - Configure SMTP settings if using email verification
- Enable reverse proxy support if behind a proxy
- Copy new settings from
-
Database Migrations
- 5 new migration files will be automatically applied on server startup:
V5__security_audit.sql- Security audit tableV6__user_trusted_devices.sql- Trusted devices tableV7__user_sessions_is_restricted.sql- Session restriction flagV8__user_sessions_device_id.sql- Device ID on sessionsV9__failed_login_attempts.sql- Failed attempts trackingV10__security_audit_status.sql- Alert status trackingV11__device_verification_tokens.sql- Verification tokens
- 5 new migration files will be automatically applied on server startup:
-
Client Updates
- Desktop, Web, and Android clients updated for new security flows
- Device ID is generated and persisted locally on first launch
- Users will see verification prompts for first-time device logins
For Docker/Container Users
- Environment variables support all new config options via
env-mapping.json - Database migrations run automatically on container startup
- No manual migration steps required
🔄 Breaking Changes
Client Applications:
- Login endpoints now require
deviceIdin request payload - Auth ViewModel replaced with focused ViewModels - update dependency injection
- Device identity must be generated and persisted by clients
API Consumers:
- Login response now includes
isRestrictedflag for device status - New
verification-requirederror code for unverified devices - Email configuration required for device verification flows
Server Deployment:
- Email configuration is required if account security mode is enabled
- SMTP credentials must be set in environment/config before first use
- Reverse proxy setup may require explicit trust configuration
📋 Database Migrations Summary
Migration Purpose V5 Security audit tracking (device, IP, timestamp, status) V6 User trusted devices (device-user relationships) V7 Session restriction flag (for unverified devices) V8 Device ID field on sessions V9 Failed login attempts sliding-window tracking V10 Security audit status (PENDING/TRUSTED/DISMISSED) V11 Device verification tokens (single-use verification)
📦 New Dependencies
jakarta.mail:jakarta.mail-api- Email APIcom.sun.mail:angus-mail- Mail transport provider
🧪 Testing & Validation
For Users
- Login from a new device - you should receive a verification email
- Click verification link or use the in-app verification dialog
- After verification, device is marked as trusted
- Check "Trusted Devices" in user menu to see all trusted devices
- Try changing your email or password - both require current password confirmation
For Administrators
- Monitor security audit logs for suspicious patterns
- Configure account security mode appropriate for your deployment (strict for high-security)
- Test email delivery if enabled
- Verify IP tracking is correct if behind a reverse proxy
- Check failed login attempts are being tracked properly
For Integration Teams
- Update clients to send
deviceIdwith login requests - Handle
verification-requirederror code appropriately - Update UI to display restricted session state
- Implement email verification dialog if needed
- Fetch account validation policy from public endpoint
🐛 Known Limitations
- Device trust is device-scoped, not session-scoped (one device = one trusted identity)
- Email verification tokens expire after 24 hours
- Failed login window is rolling (calculated from each attempt)
- Reverse proxy IP detection requires explicit trust configuration
- SMTP is the only email provider currently supported
📚 Documentation
- See
docs/Misc/arrow-typed-errors.mdfor error handling patterns - Review
deploy/server/application.example-vps.jsonfor production configuration - Check
server/dev-config-sample/for development setup examples
🙏 Contributors
Thanks to everyone who tested, reviewed, and provided feedback on the security features!
📝 Release Notes Highlights
Total Changes: 45 commits
Files Modified: 150+ files
New Services: 5 (Token, DeviceTrust, SecurityAudit, AccountManagement, SecurityNotification)
New ViewModels: 5 (AuthEntry, Session, AccountManagement, SecurityAudit, UserProfile)
New API Endpoints: 11
New Database Tables: 5
Test Coverage: 25+ new test classes
🔗 Related Issues & PRs
- PR #211: Settings and server details improvements
- PR #212: Comprehensive security and session management
- PR #213: Authentication refactoring and finalization
For upgrading from v0.3.x, please review the Breaking Changes section above.
Enjoy the enhanced security features in Torvian Chatbot v0.4.0! 🚀
Downloads
-
Source code (ZIP)
0 downloads
-
Source code (TAR.GZ)
0 downloads