SPB Git

Repository Public License

THREAT_MODEL.md 13.3 KB

# Threat model

ORIX Navigator, state of the code base on 2026-11-25 (milestone 0.1 in progress). This document lists what is protected, from whom, which mitigations exist in the code today (with the file to look at), and what remains exposed. A mitigation that is planned but not written is listed under "residual risk", not under "mitigation".

It is a design review by the people writing the code, not the result of a penetration test or an external audit. Nothing here has been attacked on purpose.

# Assets

Asset Where it lives
Website sessions: cookies, storage, service workers WebKit data store of each profile (WKWebsiteDataStore(forIdentifier:)), on disk; in memory for private profiles
Browsing history, bookmarks, open and closed tabs, WebKit session state of tabs, download list, permissions, notes, canvases, agent runs, settings Navigator.sqlite (Persistence)
Secrets: AI provider API keys, sync credentials Keychain only (KeychainSecretStore)
Downloaded files Where the user saved them
What the user is doing right now in a private window Process memory only
The user's trust in what the address bar and the prompts say UI
Device capabilities: camera, microphone, location, clipboard, notifications Mediated by WebKit and by PermissionService

# Trust boundaries

  1. Web content ↔ browser. Everything a page sends (URLs, titles, headers, file names, script messages) is hostile input. WebKit's sandboxed web content process is the first wall; the app's own code is the second.
  2. Injected scripts ↔ page scripts. The browser's bundled scripts run in isolated content worlds; the page world is hostile.
  3. Profile ↔ profile, and private window ↔ everything stored.
  4. Imported files ↔ storage: bookmark exports, block lists, data bundles.
  5. Agent ↔ browser capabilities (AgentRuntime, not written yet).
  6. Device ↔ sync service (SyncEngine, not written yet).
  7. App ↔ operating system: the macOS App Sandbox and iOS sandbox bound what a compromised app process reaches.

# 1. Malicious sites

Threat Mitigations in the code Residual risk
Navigation to dangerous schemes (javascript:, top-level data: / blob:, file: from the web, internal orix: pages) Scheme allow-list in WebRuntime/NavigationPolicy.swift; orix: is refused from web content there and again in InternalSchemeHandler.swift for sub-resources; application links only after a user confirmation The confirmation UI is not built yet
Invalid TLS certificates WebRuntime/CertificateTrust.swift: no path to "proceed" except an explicit per-host exception held in memory A user can still click through; exceptions last for the profile session
Plain-HTTP interception Top-level upgrade with interstitial (NavigationPolicy); make-https rule for sub-resources (PrivacyEngine/ContentRuleLists.swift); local hosts exempt make-https has no fallback and was never exercised against real pages; a user can allow HTTP per site
Look-alike host names (IDN homographs) PrivacyEngine/URLHygiene.swift HomographDetector: mixed scripts, whole-label look-alikes, invisible characters → punycode display Heuristic with coarse script ranges and no full confusables table; ASCII look-alikes (rn/m, 1/l) are not detected; the address bar must actually use it (UI not built)
Pop-up and permission prompt abuse Pop-ups denied by default, decisions per profile + origin + kind with expiry (PermissionService.swift); camera, microphone, location and motion denied on insecure origins whatever is stored Prompt fatigue; a permission granted "always" stays until revoked; no automatic expiry of unused permissions
Hostile downloads: path traversal and deceptive names DownloadEngine/DownloadFilename.swift: only the last path component is kept, separators / control / bidi / zero-width characters removed, leading dots and reserved names neutralised, length capped, the final URL is checked to be inside the destination directory, existing files are never overwritten Unicode look-alikes inside a file name are not normalised away
Hostile downloads: executable content DownloadEngine/DownloadRisk.swift classifies executables, installers, scripts and disguised double extensions; opening a risky file requires an explicit confirmation flag from the UI A risk list by extension and type is never complete; Gatekeeper / quarantine behaviour of files written by WKDownload was not checked (see DOWNLOADS.md)
Drive-by downloads Downloads the user did not start are subject to the downloads permission (ask by default) Depends on WebKit reporting isUserInitiated (macOS 15.2 / iOS 18.2 and later; older systems report false, i.e. always ask)
Tracking Built-in block list on third-party requests, optional third-party cookie blocking, user lists (ShieldService.swift); WebKit's own tracking prevention The built-in list is short and unmeasured; first-party and CNAME-cloaked tracking, fingerprinting and tracking by the visited site itself are not addressed
Exploiting WebKit itself None in this code base beyond not weakening WebKit's defaults; the web content process is sandboxed by the system A WebKit vulnerability is outside the app's control; staying on a current OS is the only mitigation

# 2. Injected scripts

Threat Mitigations in the code Residual risk
A page forges messages to the native side WebRuntime/ScriptBridge.swift: the message handler exists only in isolated worlds; every message is validated for world, frame, origin and schema; each world may send only its own kinds; URLs in payloads are restricted to http(s) The validator is the security boundary: a kind added later without a rule in allowedKinds would be a hole
A page reads or alters the browser's scripts Content worlds are isolated by WebKit Bundled scripts still read a DOM the page controls: everything they extract (metadata, reader content) is attacker-chosen data; reader HTML is re-validated natively (ReaderHTMLPolicy)
A page inflates Shield statistics ShieldService.ingest counts only listed third-party hosts, caps counts, ignores sites where Shield is off; the number is labelled an estimate Still forgeable within those bounds — by design it is never presented as fact
A page lies about "unsubmitted form input" to avoid suspension The flag only protects that tab; visible, audio and capture state come from WebKit, not from the page A page can keep itself alive in memory; the Blink budget then reports overLimitBy
User scripts Run in their own world (ScriptBridge) A user script the user installed can do anything a page script can on the pages it matches; there is no review or signature of user scripts

# 3. Cross-profile leakage

Threat Mitigations in the code Residual risk
Cookies or storage shared between profiles One WebKit data store per profile (WebRuntime/ProfileContext.swift); the identifier is never reused —
History, bookmarks, permissions, downloads of one profile shown in another Every row carries profile_id; queries take a profile; permissions are keyed by profile + origin + kind (PermissionService) Settings are global, including Shield site exceptions and imported lists: turning Shield off for a site in one profile reveals that choice in the others
A tab moved to another profile carries its history with it OrbitEngine/OrbitService.swift drops the WebKit session state (back/forward list, form state) when a tab or a window crosses a profile boundary; the page reloads from its URL in the other profile's store The URL itself and the title cross over — that is the user's explicit action
A private window leaves traces Ghost profiles are never stored: stores refuse them (Persistence, ghostWriteRejected + foreign keys), SessionOrchestrator and OrbitService drop them, PermissionService / ShieldService / DownloadManager keep their state in memory; .nonPersistent() data store; a test compares the row count of every table before and after Process memory and swap can hold private data until the app quits; files the user downloads stay (and the text says so); OS-level traces outside the app (DNS cache, network logs) are untouched; MemoryEngine and SyncEngine do not exist yet and must honour GhostPolicy when they do
Shield statistics reveal visited sites Stored per profile; cleared with history of the same period; never written for an unknown or ended private profile They are part of the JSON export, like history

# 4. Imported files

Input Mitigations in the code Residual risk
Bookmark HTML (Persistence/NetscapeBookmarks.swift) Parsed as text by a dedicated scanner, nesting bounded (64) URLs are stored as given: a javascript: bookmark is neutralised only when opened, by the navigation policy
Block lists (PrivacyEngine/ShieldModel.swift) Small documented subset; everything else rejected with a diagnostic; domains validated to ASCII host names; selectors through a character allow-list; no regular expression is ever taken from a list; size and line limits; generated filters re-validated before reaching WebKit A list can still block domains the user needs (it is the user's choice) or hide page elements deceptively (cosmetic rules can hide a warning banner): only import lists from a trusted source
Data export bundles Export only (DataLifecycle.exportJSON); there is no import path in the code An import feature, when written, needs its own validation
Downloaded archives and "capsule" imports fetched by the browser DownloadEngine/ResourceDownloader.swift: http(s) only, no cookies or credentials, size cap, destination containment The content of what is fetched is not inspected

# 5. Compromised or misled agent

Update 2026-11-25: AgentRuntime now exists. The requirements below are implemented and tested there; the defence-by-defence analysis and residual risks are in docs/AGENT_SECURITY.md.

AgentRuntime contains no code yet. What already constrains anything that will drive pages on the user's behalf:

  • Scripts evaluated for the agent run in a dedicated content world, not in the page world (ScriptBridge.swift), and messages from that world are restricted to its own kinds.
  • NavigationEntry.Transition.agent exists so agent navigations are distinguishable in history.
  • Permissions, downloads and navigation policy apply to an agent-driven tab exactly as to a user-driven one: there is no bypass parameter in PermissionService, DownloadManager or NavigationPolicy.

Residual risk — all of it open until the agent exists: prompt injection through page content (a page instructing the agent to exfiltrate data from another tab), confirmation requirements for sensitive actions (purchases, sending messages, downloads, permission grants), which tabs and profiles an agent may read, logging of agent actions for the user. None of this is designed or implemented in the code reviewed here.

# 6. Sync

SyncEngine contains no code yet. Storage keeps sync records and tombstones (SyncStore), nothing leaves the device. Residual risk when it is written: confidentiality against the sync service (end-to-end encryption is a requirement, not a fact), merge of hostile records (the OrbitalLayout.overlaps, TabLayout.tree cycle handling, SplitEngine.restored and PermissionService insecure-origin checks were written to tolerate data they did not produce), and private windows, which must never produce a sync record (GhostPolicy.syncs).

# 7. Secrets

Threat Mitigations in the code Residual risk
API keys in files, logs or exports SecretStore protocol; Keychain implementation with AfterFirstUnlockThisDeviceOnly, not synchronisable (Persistence/KeychainSecretStore.swift); the export contains no secrets; Diagnostics.Redactor strips credential-shaped text; logs mark URLs and titles private A compromised app process can read the app's own Keychain items; the unsigned development configuration uses the login keychain
Secrets inside URLs (tokens in query strings) end up in history None History stores URLs as visited; clearing history and the retention policy are the tools
Download resume data, WebKit session blobs Not exported; resume data is stored with the download row and removed with it They sit in the database unencrypted beyond the system's file protection

# Storage at rest

The database is a plain SQLite file. On iOS it has file protection completeUntilFirstUserAuthentication; on macOS it relies on FileVault and the app sandbox container. There is no application-level encryption. Anyone who can read the user's files while the device is unlocked can read the history.

# Not verified

  • No dynamic testing: nothing above was attacked. The mitigations are code that exists and unit tests that pass; whether they hold against a real adversary is unknown.
  • Rule lists were compiled by WebKit in a test and never applied to live pages.
  • The UI that must surface these protections (address-bar warnings, permission prompts, download confirmations, private-window explanations) does not exist yet: a mitigation the user never sees protects nobody.
  • The macOS sandbox entitlements are declared in project.yml; the app was not built or run sandboxed.
Files main
Menu

Theme