HostShield v6.3.0 — Security Hardening & Architecture Audit
Comprehensive security audit, architecture refactoring, and error handling improvements across the entire codebase. Net -1,400 lines (cleaner, more maintainable).
Security Hardening
- PBKDF2 PIN hashing — parental control PIN upgraded from SHA-256 to PBKDF2-HMAC-SHA256 (210K iterations) with automatic seamless migration on next login
- Encrypted backups — optional AES-256-GCM encryption for backup files with passphrase; existing plaintext backups remain readable
- DoH fail-closed — removed unpinned fallback client; all DoH queries now require certificate pinning (no silent downgrade)
- DoT response boundary check — rejects malformed/oversized DNS responses (12-4096 bytes)
- HTTPS-only sync URLs — remote rule sync enforces HTTPS with 10MB size limit and SHA-256 integrity hashing for change detection
- Shell injection prevention — RootUtil: quoted all file paths, replaced sed-based operations with Kotlin-side filtering
- WireGuard nonce randomization — transport nonces now randomly initialized to prevent reuse across sessions
- GeoIP HTTPS migration — switched from ip-api.com (HTTP) to ipapi.co (HTTPS, higher rate limits)
- Google Tink ProGuard rules — added for EncryptedSharedPreferences compatibility
Architecture Refactoring
- Preferences facade — AppPreferences now delegates to 6 domain-specific managers (BlockingPreferences, DnsPreferences, FirewallPreferences, SecurityPreferences, UiPreferences, SyncPreferences) while maintaining backward compatibility
- PacketClassifier extraction — IPv4/IPv6 packet classification logic extracted from DnsVpnService into standalone singleton for testability
- BlocklistHolder unified trie walk — single traversal gathers all decision signals instead of multiple passes
- SettingsScreen decomposition — massive UI extracted into dedicated section composables (DNS, VPN, Protection, Network Firewall)
- SettingsViewModel consolidation — 30+ separate flows grouped into 5 combined() flows
Database Optimization
- DB v12 -> v14 — two new migrations adding composite indices:
dns_logs(app_package, blocked, timestamp)for per-app drill-downhost_sources(enabled)andhost_sources(category)for source filteringuser_rules(enabled, type)for rule filtering
Error Handling & UI
- Loading/error states on Logs, Firewall, and Sources screens with persistent error banners and dismiss actions
- Search history chips on Home screen for quick re-access
- Accessibility — content descriptions added to icon-only elements on AppsScreen
- BootReceiver lifecycle — SupervisorJob with explicit cancellation prevents orphaned coroutines
- BlockNotificationService — scope lifecycle tied to start/stop to prevent reuse after cancellation
Stats
- versionCode 56
- Net -1,400 lines (1,500 added, 2,900 removed)
- 34 files changed