How snowhaze/snowhaze-ios works
1. What this repo is
- SnowHaze is an iOS privacy browser with extra network/privacy subsystems: content blocking, safe browsing, VPN, Tor support, bookmarks/history/downloads, and a Today/extension target.
- The codebase is organized as a main iOS app plus a smaller “SnowHaze VPN” target and shared submodules/assets.
2. Top-level app composition
- SnowHaze/ contains the primary browser app.
- SnowHaze VPN/ contains a Today view / extension-style component (TodayViewController.swift) with its own storyboard, localized strings, entitlements, and assets.
- shared/ contains reusable lower-level components, including code-scanner UI, regex helpers, and SQLCipher wrappers.
3. Main UI and navigation shell
- The browser UI is driven by MainViewController, TabViewController, TabController, URLBar, SearchBar, and related popover/view classes.
- The app appears to be a tabbed browser shell with separate views for settings, downloads, bookmarks/history, page info, tutorial/onboarding, and security details.
- Storyboards are used for launch and main UI, with many custom Swift view/controller classes layered on top.
4. Web content execution and page transformation
- Web content is primarily handled through WebViewManager and WorkerWebViewManager, with additional logic around BrowserPageGenerator, HTMLParser, and PagePrintRenderer.
- Several bundled JavaScript files are injected into pages to modify behavior at runtime: ad blocking, referrer stripping, canvas protection, fingerprinting protection, reader mode, login filling, search initialization/selection, night mode, and Tor/url rewriting helpers.
- This indicates a pipeline where the app intercepts page loads, rewrites or augments page content, then renders through WebKit.
5. Privacy and security enforcement layer
- The core privacy boundary is centered on PolicyManager, PolicyAssessor, ContentBlockerManager, TrackingSettingsManager, HTTPSSettingsManager, JavaScriptSettingsManager, CookieBlockingPolicy, and PopoverBlockingPolicy.
- These managers determine what is allowed per site and globally: script execution, third-party trackers, cookies, popovers, media playback, mixed content, HTTPS upgrades, and website data handling.
- URLInjectionDetection, URLParamStripRule, Redirector, and MaskingRule suggest request/URL sanitization before navigation proceeds.
6. Threat intelligence and classification data
- The app ships with a bundled data layer under shared/large-data/lists.db plus geo-IP files (geoip, geoip6).
- The README confirms categories such as HTTPS-capable sites, ad networks, tracker hosts, private/dangerous sites, URL parameter rules, popular sites, and content blockers.
- This data feeds the browser policy decisions, safe browsing, search suggestions, country/flag display, and likely routing/UI hints.
7. Persistent storage and encrypted local state
- Local browser state is persisted through DataStore, History, Bookmark, download models, subscription/settings managers, and encrypted database helpers.
- The presence of shared/sqlcipher/ and EncryptedDBHelpers shows that sensitive persisted data is stored in an encrypted SQLite/SQLCipher layer rather than plain local storage.
- This storage boundary likely covers history, bookmarks, subscriptions, cached intelligence, and settings that need durability.
8. Network stack and remote services
- Network access is abstracted through fetchers and session wrappers like DataFetcher, JSONFetcher, SnowHazeURLSession, Pinger, and V3APIConnection.
- ServerTrust, SecPolicyEvaluator, and Cert indicate custom TLS/certificate validation and trust evaluation.
- External network communication exists for browsing, safe browsing updates, subscription-related features, search suggestions, and possibly VPN/Tor control, but the app is designed to avoid unsolicited connections.
9. VPN and Tor subsystems
- VPNManager, VPNSettingsManager, TorServer, TorSchemeHandler, TorHelpers, TorSettingsManager, and TorInfoView form distinct privacy-routing pathways.
- Architecturally, these are optional transport layers beneath or beside the browser’s normal WebKit networking path.
- The browser can surface status/UI for Tor/VPN and likely route selected traffic through those systems depending on settings and user choice.
10. Browser features built around web state
- Bookmarks, history, suggestions, and “home/popular sites” are first-class subsystems with dedicated sources and UI cells/views.
- Downloads are handled separately via DownloadManager, DownloadActivity, DownloadProgressIndicator, FileDownload, and DownloadsList.
- Other browser features include find-on-page, page previews, page info/security indicators, print rendering, and tab selection/layout controls.
11. Authentication, passcodes, and user settings
- Local protection is implemented via PasscodeManager, PasscodeController, PasswordValidator, and LockController.
- Settings are highly modular: there are many dedicated managers for appearance, defaults, content blocking, external bookmarks, search engine, media playback, safe browsing, VPN, Tor, warnings, website data, and more.
- This suggests a settings architecture built from feature-specific managers rather than one monolithic settings store.
12. Shared utilities and platform glue
- The repo contains a lot of supporting code for strings, URL handling, dispatch helpers, randomization, hex/encoding, punycode/IDNA, JSON/path parsing, templating, and text utilities.
- There is Objective-C/C bridging for WebKit and lower-level pieces (WebKitFixes.m/.h, SimplePing.m/.h, bridging.c, SnowHaze-Bridging-Header.h), showing a mixed Swift + native interop boundary.
- CocoaPods and Xcode workspaces are the build/tooling layer; the app is iOS-native, localization-heavy, and asset-driven.
13. Non-browser side utilities
- shared/code-scanner is a self-contained camera/code scanning component, likely reused by the browser for QR/code workflows.
- shared/large-data also contains many localized icons and tutorial assets, showing that much of the user-facing product surface is bundled and offline-capable.
- The overall architecture is therefore an offline-first local app core with selective network dependencies and several privacy-preserving transport/content layers.
Main entry points: MainViewController.swift Main View · DataFetcher.swift Network Stack · WebViewManager.swift Web Runtime · Safebrowsing.swift Safe Browsing
Components 20
Main App
Primary iOS browser target and its core runtime.
- App Shell · Application lifecycle and top-level setup for the browser target.
SnowHaze/AppDelegate.swift - Main View · Primary browser container coordinating tabs, bars, and page state.
SnowHaze/MainViewController.swift - Tab System · Tab models and selection/navigation controls for multiple pages.
SnowHaze/TabViewController.swift - URL Bar · Address/search entry and suggestion-driven navigation.
SnowHaze/URLBar.swift - Web Runtime · WebKit page loading, worker views, and page generation pipeline.
SnowHaze/WebViewManager.swift - Page Transform · HTML parsing and injected JavaScript used to modify page behavior.
SnowHaze/BrowserPageGenerator.swift - Policy Core · Per-site and global privacy enforcement decisions.
SnowHaze/PolicyManager.swift - Blocking · Content blocker rules, tracker lists, cookie and popover restrictions.
SnowHaze/ContentBlockerManager.swift - Safe Browsing · Malicious site checks, caching, networking, and storage for reputation data.
SnowHaze/Safebrowsing.swift - Local Store · Browser state persistence including history, bookmarks, downloads, and settings wrappers.
SnowHaze/DataStore.swift - Browser Features · Bookmarks, history, downloads, find-on-page, page info, and print/page preview flows.
SnowHaze/DownloadsList.swift - Settings · Modular settings managers for appearance, search, VPN/Tor, warnings, and data policies.
SnowHaze/SettingsViewController.swift - Security UI · Passcode, lock, TLS/certificate details, and security status presentation.
SnowHaze/TLSInfoView.swift - Network Stack · Fetchers, URL sessions, pings, API connections, and trust evaluation.
SnowHaze/DataFetcher.swift - VPN Layer · VPN manager and VPN-specific settings controlling optional routed traffic.
SnowHaze/VPNManager.swift - Tor Layer · Tor server, scheme handler, helpers, and Tor-specific settings/status UI.
SnowHaze/TorServer.swift
VPN Extension
Today/extension-style VPN status and control surface.
- VPN Widget · Today view controller and storyboard for the VPN extension surface.
SnowHaze VPN/TodayViewController.swift
Shared
Reusable scanners, storage, and low-level helpers.
- Code Scanner · Reusable camera-based code scanning component.
SnowHaze/shared/code-scanner/ScanCodeViewController.swift - SQLCipher · Encrypted SQLite wrapper used for sensitive local persistence.
SnowHaze/shared/sqlcipher/SQLiteManager.swift
Data & Assets
Bundled lists, geodata, and privacy/page assets.
- Shared Assets · Large bundled lists, icons, tutorials, and geodata used by the app.
SnowHaze/shared/large-data/lists.db
Connections 21
- App Shell → Main View: launches · Creates and hands off to the main browser interface.
- Main View → Tab System: coordinates · Manages the active tab set and selection flows.
- Main View → URL Bar: hosts · Integrates URL/search entry with browser navigation.
- Main View → Web Runtime: drives · Requests page loads and receives web state updates.
- Web Runtime → Page Transform: builds pages · Transforms content before WebKit renders it.
- Page Transform → Blocking: applies rules · Uses injected scripts and blocking logic to alter page behavior.
- Policy Core → Blocking: configures · Feeds site/global privacy policy into blockers.
- Policy Core → Web Runtime: governs · Controls what the web runtime may execute or load.
- Blocking → Shared Assets: reads lists · Consumes bundled classification and blocker data.
- Safe Browsing → Shared Assets: uses intel · Relies on packaged reputation and geo data.
- Safe Browsing → Network Stack: updates · Fetches remote threat data and related metadata.
- Local Store → SQLCipher: encrypts · Persists sensitive local state through encrypted SQLite.
- Browser Features → Local Store: persists · Stores history, bookmarks, downloads, and page state.
- Settings → Local Store: reads/writes · Manages durable configuration and feature preferences.
- Security UI → Network Stack: validates · Uses trust and certificate evaluation for connections.
- Network Stack → Safe Browsing: supports · Provides remote connectivity for reputation lookups and updates.
- Network Stack → VPN Layer: routes via · Can operate through VPN-controlled transport.
- Network Stack → Tor Layer: routes via · Can operate through Tor-controlled transport.
- VPN Layer → VPN Widget: surfaces · Exposes VPN status and controls in the extension UI.
- Tor Layer → Web Runtime: intercepts · Provides alternate web request handling for Tor traffic.
- Code Scanner → Main View: embedded in · Reusable scanner UI can be invoked from the browser.