SPB Git

Repository Public License

privacy.md 15.3 KB 217 lines markdown

1<!--2ORIX Secure3File: docs/architecture/privacy.md4Description: Privacy audit, the app's own permissions, privacy manifest, stored data and retention, export5             redaction, App Lock and what the app cannot see about other apps.6Author: Simon-Pierre Boucher7Contact: contact@spboucher.ai8-->910# ORIX Secure — Privacy1112Sources: `ORIXSecureEngines/PrivacyAuditEngine.swift`, `ORIXSecureEngines/Checklist.swift`13(`ChecklistCatalog.privacyItems`), `App/Sources/Core/AppModel.swift` (`permissions`), `AppLock.swift`,14`AppSettings.swift`, `LocalStore.swift`, `ORIXReporting/Redaction.swift`, `App/Resources/Info.plist`,15`PrivacyInfo.xcprivacy`, `ORIXSecure.entitlements`.1617## 1. Privacy assessment1819```mermaid20flowchart TD21    subgraph Own["ORIX Secure's own permission states"]22        P1["PHPhotoLibrary.authorizationStatus(for: .readWrite)"]23        P2["AVCaptureDevice.authorizationStatus(for: .video)"]24        P3["CLLocationManager.authorizationStatus"]25        P4["Local network: no public API → .unknown"]26        P5["Face ID: inferred from SecuritySignals<br/>and AppSettings.appLockEnabled"]27    end28    P1 --> PERM["[AppPermission]<br/>AppModel.permissions(settings:signals:)"]29    P2 --> PERM30    P3 --> PERM31    P4 --> PERM32    P5 --> PERM33    ANS[("StoredAnswer rows")] --> RESP["[ChecklistResponse]"]34    PERM --> ENG["PrivacyAuditEngine.audit(permissions:responses:now:)"]35    RESP --> ENG36    CAT["ChecklistCatalog.privacyItems — 16 items"] --> ENG37    ENG --> F1["appPermissions: 5 findings<br/>privacy.app.KIND"]38    ENG --> F2["checklist: 16 findings<br/>SecurityChecklistEngine rules"]39    ENG --> F3["practices: 7 facts about the app"]40    ENG --> F4["notAssessable: 4 platform limits"]41    F1 --> AUD["PrivacyAudit"]42    F2 --> AUD43    F3 --> AUD44    F4 --> AUD45    AUD --> SUM["AssessmentSummary — counts and coverage, no score"]46    AUD --> REP["ReportBuilder.privacy → ReportDocument kind .privacyAudit"]47```4849- Permission findings (`privacy.app.photos`, `.camera`, `.location`, `.localNetwork`, `.faceID`) have state50  `verified` (`measured` / `publicAPI`) for every status except `.unknown`, which gives `notAvailable`51  (`none` / `notVerifiable`). `verified` here means "the state was read", not "the state is good": a denied52  permission is reported as a fact with the feature it disables. Each finding carries the purpose text53  (`AppPermissionKind.purpose`), the Settings path and the note that other apps' permissions cannot be read.54- The Face ID status is not read from an OS permission API. It is `denied` when `biometryEnrolled` is55  unavailable with kind `permissionRequired`, else `granted` when App Lock is enabled, else `notRequested`.56- Checklist findings follow the rules in [security-engine.md](security-engine.md) §4. The 16 items cover57  tracking and advertising (`priv.tracking`, `priv.ads`, `priv.safari.tracking`, `priv.mail`), app58  permissions (`priv.location.review`, `priv.photos.review`, `priv.mic.review`, `priv.camera.review`,59  `priv.contacts.review`, `priv.localnetwork.review`, `priv.bluetooth.review`, `priv.report`), sharing60  (`priv.safetycheck`, `priv.analytics`, `priv.significant` — optional) and the Lock Screen (`priv.previews`).61  The app cannot read any of these settings; a result is always what the user reported.62- `PrivacyAuditEngine.practices` states seven facts about the app: no account, no advertising or analytics63  SDK, no tracking, no data collected by the developer, results stored on the device only, network64  connections limited to the tests the user starts, photos analysed on the device.6566## 2. The app's own permissions6768| Permission | Info.plist key | Where the request happens | Without it |69|---|---|---|---|70| Photos (read-write) | `NSPhotoLibraryUsageDescription` | `PhotoCleanupController.requestAccess()` → `PHPhotoLibrary.requestAuthorization(for: .readWrite)`, from the "Choose Photo Access" button in `PhotoCleanupView`; also by the `photos.scan` workflow step in `ActionsController` when access is `notDetermined`. | Photo Cleanup stays off. Limited access works and is labelled as partial coverage. |71| Camera | `NSCameraUsageDescription` | `LinkAnalyzerView.openScanner()` → `AVCaptureDevice.requestAccess(for: .video)` when the status is `.notDetermined`, after the user taps "Scan QR"; the scanner sheet is then shown. | The sheet shows "Camera not available" with a link to Settings; "QR from Photo" (`PhotosPicker` + Vision) works without any permission. |72| Location (when in use) | `NSLocationWhenInUseUsageDescription` | `NetworkController.requestLocationForWiFi()` → `CLLocationManager.requestWhenInUseAuthorization()`, from "Allow to Read Wi-Fi Security" in `NetworkLabView`. | `wifi.security` is `notAvailable` with the reason; all other network checks work. |73| Local network | `NSLocalNetworkUsageDescription`, `NSBonjourServices` (14 types) | Triggered by iOS at the first `NWBrowser` start, i.e. "Scan Local Network" (`NetworkController.browseLocalNetwork()`). | The browse reports `permissionRequired`. |74| Face ID | `NSFaceIDUsageDescription` | `AppLock.enable()` / `disable()` / `unlock()` → `LAContext.evaluatePolicy(.deviceOwnerAuthentication)`, when the user turns App Lock on or off in Settings or the app is locked. | The passcode remains a fallback; App Lock is optional. |7576Further facts:7778- `CLLocationManager` is used for its authorization and accuracy state only. No call to `requestLocation`,79  `startUpdatingLocation` or any other position API exists in the app; no coordinate is read or stored.80- `PHPhotoLibrary.authorizationStatus`, `AVCaptureDevice.authorizationStatus` and81  `CLLocationManager().authorizationStatus` are read at every `AppModel.recompute()` without prompting.82- The app never requests tracking authorization, contacts, microphone, Bluetooth, calendars, health or83  notifications; the corresponding usage-description keys are absent from `Info.plist`.84- The single entitlement is `com.apple.developer.networking.wifi-info`. There is no iCloud, App Group,85  keychain-sharing, push or NetworkExtension entitlement.86- Files reach the app through `fileImporter` (security-scoped URLs opened and closed around each87  operation), "Open in ORIX Secure" (document type `public.data`, not opened in place) and the `PasteButton`88  for links, which requires no pasteboard permission prompt. The file scanner writes to the pasteboard only89  when the user taps "Copy" on a hash.90- Share extension: activation rule `NSExtensionActivationSupportsWebURLWithMaxCount` 1 and91  `NSExtensionActivationSupportsText`. It analyses the shared link in place with `URLRiskAnalyzer`, makes no92  network request, writes nothing, and shares no container with the app.9394## 3. Privacy manifest (`App/Resources/PrivacyInfo.xcprivacy`)9596| Key | Value |97|---|---|98| `NSPrivacyTracking` | `false` |99| `NSPrivacyTrackingDomains` | empty |100| `NSPrivacyCollectedDataTypes` | empty |101| `NSPrivacyAccessedAPICategoryDiskSpace` | reasons `85F4.1`, `E174.1` (volume capacity keys) |102| `NSPrivacyAccessedAPICategoryFileTimestamp` | reasons `DDA9.1`, `3B52.1`, `C617.1` (file dates in the inspector and scanners) |103| `NSPrivacyAccessedAPICategoryUserDefaults` | reason `CA92.1` (`AppSettings`) |104| `NSPrivacyAccessedAPICategorySystemBootTime` | reason `35F9.1` (`kern.boottime`) |105106The share extension has its own manifest, `ShareExtension/Resources/PrivacyInfo.xcprivacy`: tracking107`false`, no tracking domains, no collected data types, and an empty `NSPrivacyAccessedAPITypes` array (it108uses no required-reason API). `ITSAppUsesNonExemptEncryption` is `false` in the app's `Info.plist`.109110## 4. Data stored and for how long111112| Data | Where | Written when | Removed when |113|---|---|---|---|114| Saved reports (`StoredReport`) | SwiftData store, `Application Support/ORIXSecure/Database` | The user taps a save button; a file cleanup completes; a workflow generates its report; a link is analysed while link history is on. | Per-report delete, "Delete N Report(s)", or "Erase All App Data". No automatic expiry. |115| Checklist answers (`StoredAnswer`) | SwiftData store | The user answers an item (one row per item). | The user clears the answer, or "Erase All App Data". An answer older than the item's `validityDays` is ignored by the engine but stays stored. |116| Workflows (`StoredWorkflow`) | SwiftData store | The user saves a workflow. | Deleted individually, or "Erase All App Data". |117| Preferences | `UserDefaults` | Settings changes. | "Erase All App Data" calls `AppSettings.reset()` (link history, redaction and appearance return to their defaults), then restores `hasSeenWelcome = true` and the previous App Lock setting. Also reset by the debug launch option `-ORIXReset`. |118| Photo fingerprints | `Caches/ORIXSecure/orix-media-fingerprints.cache` | Each photo scan. | Pruned to existing assets at each complete scan; "Clear Caches and Temporary Files"; iOS may purge Caches. |119| Export files | `tmp/ORIXSecureExports` | An export is rendered for the share sheet. | "Clear Caches and Temporary Files", "Erase All App Data"; iOS may purge `tmp`. Not removed automatically after sharing. |120121Held in memory only and lost when the process ends: the device snapshot, security signals, network change122log (200 entries), DNS / latency / TLS / HTTPS / Bonjour results, the photo analysis and selection, file123inspection results and an unsaved link analysis.124125What a report contains: `ReportBuilder.deviceFacts` writes the model identifier and system version (and a126Simulator note). No device name, serial number, advertising identifier or account identifier is read anywhere127in the code. A network report can contain this device's interface addresses, the SSID and BSSID, proxy128endpoints and the probed host; a link report contains the link as received (clipped to 300 characters); a129file report contains the file name, size, dates and SHA-256.130131Protection at rest: the app's folders are created with `FileProtectionType.complete` as a directory attribute132(see [overview.md](overview.md) §4). Nothing is synced: there is no CloudKit configuration and no iCloud133entitlement.134135## 5. Link history (off by default)136137`AppSettings.keepLinkHistory` defaults to `false` (`defaults.bool(forKey:)` of an unset key). With the138default, `LinkAnalyzerView.analyze()` keeps the analysis in view state only; it is stored only if the user139taps "Save as Report". With the setting on, every analysed link is saved as a `.urlAnalysis` report. Links140decoded from a QR code go through `handleQR` and are not auto-saved by this setting. The share extension141never stores anything.142143## 6. Export redaction144145`ReportsView.export` renders a stored report as PDF, Markdown, JSON or plain text (`ReportFormat`) into146`AppFolders.exports` and hands the file URL to `UIActivityViewController`. When `AppSettings.redactExports`147is on (the default), it exports `report.redacted(.all)`; the export menu header states which of the two148applies. The stored report is never modified.149150`RedactionOptions` fields, all enabled by `.all` (`additionalTerms` stays empty in the app):151152| Option | Effect |153|---|---|154| `deviceName` | Masks the value of any fact or evidence whose label contains a device/host-name term (English and French list), and every other occurrence of that value. |155| `additionalTerms` | Extra literal strings to mask everywhere. |156| `ipAddresses` | Masks IPv4 addresses (pattern) and IPv6 addresses (pattern proposes candidates, `inet_pton` decides). |157| `networkIdentifiers` | Masks values labelled SSID / BSSID / network name, their other occurrences, and any MAC-style address. |158| `filePathUsers` | Masks the user segment of `/Users/<name>/`, `/home/<name>/` and container identifiers in app-container paths. |159| `urlQueries` | Replaces the query string of full URLs with the marker. |160161Mechanics and limits, as coded in `Redactor`:162163- Label-sensitive values of at least 3 characters are collected first and replaced everywhere164  (case- and diacritic-insensitive, longest first), in titles, summaries, paragraphs, bullets, facts, finding165  text and evidence.166- Detection is by label and by pattern. The doc comment on `redacted(_:)` says to review the result before167  sharing, because free text can still identify the user.168- Host names, domains and file names are not masked by any option; only the query part of a URL is.169- Redaction applies at export time only; reports viewed in the app are shown in full.170171## 7. App Lock172173`AppLock` (`App/Sources/Core/AppLock.swift`), off by default:174175- `enable()` requires a successful `evaluatePolicy(.deviceOwnerAuthentication)` before setting176  `appLockEnabled`, so the lock cannot be turned on without proving that authentication works. The toggle is177  disabled when `AppLock.isAvailable` is false (no device passcode).178- `isLocked` starts as `appLockEnabled` at launch and is set again by `lockIfEnabled()` when the scene phase179  becomes `.background`.180- While locked, `ORIXSecureApp` overlays `LockScreen` on the root view; it calls `unlock()` on appearance and181  from its button. The policy is `.deviceOwnerAuthentication`: biometrics first, device passcode as fallback.182  The authentication error text, if any, is shown on the lock screen.183- `disable()` is `async` and requires a successful `evaluatePolicy(.deviceOwnerAuthentication)` before184  turning the setting off; on failure the Settings screen reports that App Lock stays on.185- `forceDisable()` turns the setting off and unlocks without authentication. It is called by `disable()`186  after authentication and has no other caller in the app.187- "Erase All App Data" keeps the App Lock setting as it was, so erasing data is not a way around the lock.188- App Lock is a UI gate. It adds no encryption layer of its own and does not apply to the share extension.189190## 8. What the app cannot see about other apps191192`PrivacyAudit.notAssessable` lists four entries of `PlatformLimits.securityAssessments`, shown in the audit193and written to the report's `unavailable` list:194195| id | Limit |196|---|---|197| `apps.permissions` | Permissions granted to other apps: an app reads its own states only (Settings › Privacy & Security). |198| `apps.installed` | The list of installed apps cannot be enumerated. |199| `safari.history` | Safari history and website data, like any other app's data, are outside the sandbox. |200| `traffic.others` | Other apps' network traffic is invisible without a VPN or content-filter entitlement; ORIX Secure installs neither. |201202Consequences in the design: the privacy checklist sends the user to the relevant Settings pane203(`openSettings()` opens the app's own Settings page) and records the answer as `userReported`; the item204`priv.report` points to App Privacy Report, the system feature that holds per-app access and network205activity. The app makes no claim about any other app.206207## 9. Verification status208209- `DeviceStoragePrivacyTests` covers the permission findings for every kind and status and the audit210  structure; redaction is covered by `ORIXReportingTests`. They were not re-run while writing this document.211- Permission prompts for Photos, camera, location and local network, and the Face ID / passcode sheet, were212  exercised in the iOS Simulator or compiled only; none was verified on a physical device.213- The file-protection class of the SwiftData store and export files was not measured on a device; the214  `app.dataProtection` probe that would report the class of a new file is unavailable in the Simulator.215- The App Lock overlay was not tested against the app-switcher snapshot taken when the app leaves the216  foreground: the lock is set on `.background`, not on `.inactive`.217
Files main
Menu

Theme