Files
Vorleser-Kit/docs/SECURITY_PRIVACY.md

43 lines
2.9 KiB
Markdown

# Security and privacy requirements
These are hard requirements. The `swift-reviewer` agent checks every change against this list.
## Data handling
| ID | Requirement | How to verify |
|---|---|---|
| SP-1 | Selected text is captured only after an explicit trigger (hotkey, Services, menu command). | No AX observers (`AXObserverCreate`) on other apps; no timers reading selections. Grep the code for `AXObserver`. |
| SP-2 | Selected text never appears in logs. | All `Logger` interpolations of text use `privacy: .private`; prefer logging `text.count`. Grep for `\(text` / `\(segment.text` without `.private`. |
| SP-3 | No telemetry, analytics, crash-reporting SDKs. | `Package.resolved` contains only allowed deps. |
| SP-4 | Network requests only to the configured Ollama endpoint. | All networking goes through `OllamaHTTPClient`. Grep for `URLSession` usage outside `VorleserOllama`. |
| SP-5 | Default endpoint is loopback. Non-loopback requires `allowRemoteEndpoint == true` and an `https` scheme. | Unit test `EndpointPolicyTests`. |
| SP-6 | No disk persistence of text or audio by default. | Disk cache off by default; settings test. |
| SP-7 | Disk cache (if enabled): stored under Caches, keyed by SHA-256, size-capped, user-clearable, no clear-text text. | `DiskAudioCacheTests` |
| SP-8 | Clipboard fallback is off by default, disclosed in UI, and always restores the prior pasteboard (all items, all types). | `ClipboardCapturerTests` with an injected pasteboard abstraction |
| SP-9 | The session's in-memory text and PCM are released on `stop` and on replacement by a new session. | Test that the cache count is 0 after stop |
| SP-10 | The app never requests permissions it does not use: Accessibility only. No Input Monitoring, Screen Recording, Microphone. | Info.plist has no usage strings for unused permissions |
## Entitlements and runtime
- App Sandbox: **disabled** (ADR-003). Hardened Runtime: **enabled**.
- No `com.apple.security.cs.allow-unsigned-executable-memory`, `disable-library-validation`, or other hardened-runtime exceptions.
- ATS: `NSAllowsLocalNetworking = true` only. No `NSAllowsArbitraryLoads`.
## Endpoint policy (pseudo-code)
```swift
func validate(_ url: URL, allowRemote: Bool) throws {
let host = url.host?.lowercased() ?? ""
let isLoopback = ["127.0.0.1", "localhost", "::1"].contains(host)
if isLoopback { guard ["http", "https"].contains(url.scheme) else { throw … }; return }
guard allowRemote else { throw EndpointError.remoteNotAllowed }
guard url.scheme == "https" else { throw EndpointError.remoteRequiresHTTPS }
}
```
## Licensing notice (product, not code)
- Vorleser does not bundle or redistribute any model or voice.
- Settings shows the licence per model: `phonon` (31M EN) Apache-2.0; `phonon:40m-*` CC BY-NC 4.0.
- If Vorleser is ever distributed commercially, the default routing for non-English languages must be reviewed. Record the decision in an ADR.