Security model
How SPB Git for iOS protects the owner's credentials, the forge and the reader's device. Server-side controls
are implemented in spbgit 3.3.0; this document states what the client relies on and what it enforces itself.
1. Principles
- The server decides. Every privileged operation is authorised by the server from the token it receives; the application never grants itself a right, and hiding a button is a convenience, not a control.
- Nothing secret ships in the binary: no token, no SSH key, no API key, no signing material, no private
endpoint. The only host in the binary is
git.spboucher.ai. - Public reading needs no account and sends no identifier other than the visitor-pass cookie the website also uses.
- Repository content is untrusted input. It is displayed, never executed.
2. Actors and assets
| Asset | Where it lives | Threats considered |
|---|---|---|
Owner token (spbgit_<id>_<secret>) |
device Keychain | theft from an unlocked or backed-up device, leak through logs, crash reports, pasteboard, screenshots, the shared HTTP cache |
| Repositories on the forge | server | unauthorised write, destructive mistake, overwrite of a concurrent push, injected git arguments or paths |
| The forge uplink and CPU | server | the application behaving like a crawler |
| The reader's device | device | hostile repository content: HTML and Markdown with scripts, huge files, decompression bombs, malformed media, path tricks in file names |
3. Authentication and the owner mode
- The owner pastes or scans a personal access token created for this device (label, scopes, expiry). The
application verifies it with
GET /api/v1/whoamibefore storing it and shows the scopes and the expiry date. - Storage: Keychain generic password,
kSecAttrAccessibleWhenUnlockedThisDeviceOnly, protected by an access control requiring user presence (.userPresence: Face ID or Touch ID with passcode fallback). The item is not synchronised to iCloud and is excluded from backups by its accessibility class. The token is never written to UserDefaults, files, logs, analytics, the pasteboard or widgets. - Unlock: the token is read from the Keychain after a successful LocalAuthentication prompt and kept in memory by an actor for the duration of the owner session. The session locks when the application goes to the background for longer than the configured delay (default 5 minutes, immediately if the owner chooses so) and on demand.
- Face ID is a local gate on the stored token. It is not an authorisation: the server checks the token, its expiry and its scopes on every request.
- Scopes (3.3.0):
repo:write,repo:admin,tokens,admin. The application asks for the least it needs and adapts the interface to the scopes reported bywhoami. A403 insufficient_scopeis shown as such. - Expiry and revocation:
401 token_expiredor401 unauthorizedends the owner session, removes the token from the Keychain after confirmation and returns to public mode. Tokens can be listed and revoked from the application (scopetokens); revoking the current token signs out. - Passkeys: the server has no passkey endpoint in 3.3.0 (the forge has no accounts, only tokens). The client therefore does not offer passkeys in 1.0; the authentication layer is isolated behind a protocol so that a WebAuthn-issued token can be added without touching the features.
4. Transport
- HTTPS only, App Transport Security without exception, TLS validated by the system trust store. No custom trust evaluation that could weaken it, no arbitrary loads.
- Requests with a token use an ephemeral
URLSessionconfiguration: no cookie storage, no URL cache on disk. Authenticated responses are never written to the shared disk cache, and theAuthorizationheader is never logged. - Redirects to another host are not followed for authenticated requests.
5. Write operations
- Every write shows what will happen before it is sent: files and diff for a commit, the exact branch, tag or repository name for the others.
- Concurrency: a commit carries
expectedHead(the branch tip the editor loaded) and, per file,expectedOid. The server applies it withgit update-ref <ref> <new> <old>; if the branch moved it answers409 head_movedand nothing is written. The application then shows the incoming commits and lets the owner reload; it never retries a write blindly. - Destructive operations (deleting a repository, a branch or a tag, revoking a token) require typing the name of the object, then a fresh biometric confirmation. Repository deletion is a soft delete on the server (30 days in the trash) and the dialog says so.
- Every authenticated write is recorded by the server in an append-only audit log (date, token id and label,
address, action, repository, short detail; no secret, no content). The application shows this log to the
owner (scope
admin). - Operations are real or absent. When the server refuses or lacks a route, the application says so; it never displays a simulated success.
6. Untrusted repository content
| Content | Handling |
|---|---|
| Source and text files | rendered as text with a native highlighter; size limits; paged loading above 1 MiB; no file above the configured limit is loaded into memory whole |
| Markdown | parsed and rendered with native views; raw HTML inside Markdown is shown as text, not interpreted; links open only https, http and mailto after confirmation of the host when it differs from the forge; images load only over HTTPS and only from the forge by default (remote images are opt-in) |
| HTML files | shown as source. The optional preview uses a non-persistent WKWebView with JavaScript disabled, no network access (content rule list blocking every request), no file access and no link navigation |
| PDF, images, audio, video | PDFKit, ImageIO with a pixel-count ceiling, AVFoundation; downloaded to the application's temporary directory with a generated file name, never the repository-provided path |
| Quick Look | only for files the user opens explicitly, from a sandboxed temporary copy |
| Archives | never unpacked by the application |
| File names and paths | treated as display strings; local file names are derived from a hash; path components are validated (.., absolute paths, control characters refused) before any use in a URL |
| JSON, CSV | parsed with depth, node-count and row limits; beyond them the file is shown as text |
Nothing from a repository is executed, opened in another application automatically, or added to the shared pasteboard without a user action.
7. Being a well-behaved client of the shield
The application obtains a visitor pass by proof of work like any browser, identifies itself honestly in its user
agent, coalesces and caches requests, honours Retry-After, and never crawls: no background enumeration of
trees, no prefetch of files the reader did not open, offline downloads only on explicit request with the size
shown beforehand and a ceiling. It has no hidden bypass of the shield.
8. Privacy
No analytics, no advertising, no third-party SDK, no tracking. Favourites, history, search history and offline copies stay on the device (application container and App Group shared with the widgets), and can be erased from the settings. Push notifications are opt-in; when enabled the server stores the APNs device token, the followed repository names and the locale, and deletes them when notifications are turned off. The privacy manifest declares no collected data and no tracking domain.
9. Verification
The checks run for the release are recorded in SECURITY_REPORT.md (written at the security phase): Keychain
attributes on a device build, absence of the token in logs and caches, binary strings and hosts, behaviour of
each refusal (401, 403, 409), hostile content samples, and the server-side tests of the write path.