Security model
Every OTA download must pass three independent checks before the staged directory can ever become eligible to boot.
Jolt Fault Lab
Three-Part Verification Gate Lab
ota-ns serve --mode update1. Authenticity (Ed25519)PASS
CryptoKit / Google Tink
keyId="prod-2026" verified on canonical JCS payload
2. Compatibility & SeqPASS
runtimeContract + targetBuild
ios-rc-16579a18 · build 1 · directiveSeq 8 > 7
3. Integrity (SHA-256)PASS
Streaming 11/11 files
Exact byte lengths, zero symlinks, zero extra files
STAGE_COMMITTED (ota-vue-v2)
All three gates passed: staging/ moved atomically into releases/ota-vue-v2.
Three separate security questions
| Property | Question answered | Enforcement |
|---|---|---|
| Authenticity | Was this directive and manifest authorized by the publisher? | Ed25519 signature over canonical JCS payloads verified via Apple CryptoKit (iOS) or Google Tink Ed25519Verify (Android) against public keys embedded in the binary (publicKeys[keyId]). |
| Integrity | Did every file arrive intact with no extras or path traversal? | Every file in manifest.files is downloaded to isolated staging/<releaseId>, checked for exact byte length and streaming SHA-256 digest, with symlinks, .. traversal, missing files and unexpected extra files rejected. |
| Compatibility & freshness | Can this release run on this binary without replaying an older directive? | protocolVersion, appId, platform, targetBuild and runtimeContract must match the installed binary; directiveSeq must be monotonic against lastDirectiveSeq. |
Key management & rotation
- Private signing keys never enter the app binary or app source repository.
ota-ns keygenrefuses by default to output private keys insidesrc/,app/,App_Resources/orplatforms/. - Key rotation works without a hard cutoff: embed both the current and next public keys in
ota.config.jsonunder distinctkeyIdstrings ("prod-2026","prod-2027"). Start signing releases with"prod-2027"once devices running the updated binary have rolled out, then remove"prod-2026"in a later store release.
Client threat model boundaries
Treat anything embedded in the binary as public
Any update endpoint URL, channel name or read-only API token embedded inside an iOS .ipa or Android .apk can be extracted by inspecting the binary.
- Never rely on an embedded bearer token as a substitute for Ed25519 signature verification.
- Never ship secrets, private credentials or sensitive business data inside OTA JS bundles.
- Always serve production update checks and bundle files over HTTPS (TLS). The SDK enforces HTTPS by default and rejects plain HTTP with
OtaError(INSECURE_URL)unlessallowInsecureHttp: trueis explicitly configured for local testing.
Storage hardening
- iOS: OTA state and releases live under
Library/Application Support/com.getcortexlabs.otawithNSURLIsExcludedFromBackupKeyset so iCloud/iTunes device backups do not restore stale bundles across devices or newer store binaries. - Android: OTA state and releases live inside app-private
context.getFilesDir()/ota(never external/shared storage). Keepandroid:allowBackup="false"inAndroidManifest.xmlso Android Auto Backup cannot restore mismatchedstate.jsonor release directories. - Bundle size cap:
StagingManagerenforces a configurablemaxBundleBytescap (default 50 MiB) to prevent disk exhaustion from malformed manifests.
