Threat Model: Release Integrity
|
|
| Created |
2026-10-12 |
| Last reviewed |
2026-10-13 |
| Next review due |
2027-04-13 (6-month cadence, or on any change to CI identities, OTA or the mobile release path) |
| Reviewers |
Platform owner |
| Version |
1.2 |
| Surface owner |
Platform / Release |
Scope: the identities CI holds outside the cluster, and the path that puts code on users' phones. That means the Terraform CI identity (Workload Identity Federation into GCP, plus the provider tokens it reads), the release workflows' WIF identity, OTA publishing and signing through Xavia, and the mobile client's trust in what it receives and stores.
Out of scope: image builds, ARC runners and Argo CD delivery (Secrets & Supply Chain), and sign-in (Authentication). How the pieces work: Terraform CI/CD, Deploy → Mobile app, Xavia OTA, GCP.
GitHub branch protection, rulesets and environment reviewers are not available on the org's plan for private repos. Every control below that depends on review depends on convention.
Data flow diagrams
flowchart LR
E1([E1 · repo writer]) -->|F1 push branch / PR| P1
subgraph gh[trust boundary: GitHub Actions]
P1[P1 · terraform-plan on PR<br/>terraform-apply on main]
end
P1 -->|F2 OIDC token<br/>repo, workflow, ref| P2
subgraph gcp[trust boundary: GCP project]
P2[P2 · WIF pool<br/>plan: terraform-ci, read-only<br/>apply on main: terraform-apply]
P2 --> D1[(D1 · Secret Manager<br/>provider tokens · app secrets)]
P2 --> D2[(D2 · project IAM<br/>tfstate bucket)]
end
D1 -->|F3 Cloudflare · GitHub · Tailscale tokens| P1
Path 2: OTA publish and update
flowchart LR
E1([E1 · tomoda writer]) -->|F4 push main / Release run| P3
subgraph gh[trust boundary: GitHub Actions]
P3[P3 · ota.yml on tomoda-arc<br/>prod key via WIF on main]
end
P3 -->|F8 OIDC token, ota.yml on main| P5
subgraph gcp[trust boundary: GCP project]
P5[P5 · WIF pool github-actions-tomoda<br/>tomoda-release SA]
P5 --> D4[(D4 · tomoda-ota-prod-upload-key)]
end
D4 -->|F9 prod upload key| P3
P3 -->|F5 POST /api/upload + uploadKey| P4
subgraph cluster[trust boundary: platform namespace]
P4[P4 · Xavia server<br/>holds signing private key]
P4 --> D3[(D3 · R2 tomoda-ota-*<br/>Xavia Postgres)]
end
E2([E2 · installed app<br/>bundled public cert]) -->|F6 GET /api/manifest · /api/assets| P4
P4 -->|F7 signed manifest + bundle| E2
DFD elements
| Ref |
Type |
Element |
Notes |
| E1 |
External entity |
Repo writer |
Anyone with write access to devops or tomoda |
| E2 |
External entity |
Installed app |
Verifies manifests against frontend/certs/ota-public.pem |
| P1 |
Process |
Terraform workflows |
terraform-plan.yml (pull_request), terraform-apply.yml (push to main) |
| P2 |
Process |
WIF provider |
infrastructure/gcp/wif.tf |
| P3 |
Process |
OTA workflow |
tomoda .github/workflows/ota.yml |
| P4 |
Process |
Xavia server |
k8s/envs/platform/xavia-ota-{dev,prod}/ |
| P5 |
Process |
tomoda WIF pool, tomoda-release |
infrastructure/gcp/wif.tf; tomoda tokens on refs/heads/main only |
| D1 |
Data store |
Secret Manager |
Every prod secret and provider token |
| D2 |
Data store |
Project IAM, tfstate |
terraform-apply holds projectIamAdmin; terraform-ci is read-only |
| D3 |
Data store |
OTA storage |
Bundles in R2, release records in Xavia Postgres |
| D4 |
Data store |
Prod upload key |
Secret Manager; read by tomoda-release (CI) and the prod Xavia ExternalSecret |
Assets and trust boundaries
| Asset |
DFD |
Boundary crossed |
terraform-apply and terraform-ci identities |
P1→P2 |
GitHub → GCP |
| Provider tokens (Cloudflare, GitHub, Tailscale) |
D1→P1 |
GCP → runner |
| OTA prod upload key |
D4→P3→P4 |
GCP → runner → public /api/upload |
| OTA dev upload key |
P3→P4 |
Repo secret → public /api/upload |
| OTA signing key |
P4 |
Lives in both Xavia pods' env |
| JS bundle running on every phone |
P4→E2 |
Cluster → device |
| Session tokens on the device |
E2 |
App storage |
STRIDE
Spoofing
| DFD |
Threat |
Control |
Residual |
| P1/P2 |
A branch or PR workflow impersonates the apply identity |
The github-actions pool accepts only assertion.repository == tomoda-labs/devops; fork PRs get no OIDC token. terraform-apply is bound through job_workflow_ref to terraform-apply.yml on refs/heads/main (infrastructure/gcp/wif.tf). Any other ref gets only read-only terraform-ci |
Low. A push to main applies; see finding 3 |
| P3/P4 |
Someone publishes a prod OTA bundle outside a release |
The prod upload key is in Secret Manager only. The tomoda provider accepts only ref == refs/heads/main and tomoda-release is bound through job_workflow_ref to release.yml and ota.yml on main, so branch, tag and PR runs get no token. On main, prod-pin refuses a tag devops main doesn't pin |
Medium. A push to tomoda main can edit ota.yml and skip prod-pin; see finding 3 |
| E2/P4 |
A forged server or CDN serves a bundle |
Manifests are code-signed (RSA, keyid: main); the app ships the public cert |
Low |
Tampering
| DFD |
Threat |
Control |
Residual |
| P4/E2 |
A compromised Xavia pod or upload key ships arbitrary JS |
Signing |
Medium. Xavia signs on the server with PRIVATE_KEY_BASE_64, so signing does not protect against the server or anyone holding an upload key. The app's comment that a compromised host can't push JS is wrong |
| P4 |
Dev instance compromise yields the prod signing key |
Separate instances, upload keys and DB passwords |
Medium. One signing key is shared by dev and prod; both pods sit in platform |
| D3 |
Bundle replaced in R2 |
Bundles are signed at publish; R2 token is cluster-scoped |
Low. A swapped asset fails the hash in the signed manifest |
| E2 |
Bundle for an incompatible binary |
runtimeVersion fingerprint policy |
Low |
Repudiation
| DFD |
Threat |
Control |
Residual |
| P3/P4 |
Who published a bundle |
Xavia records commit hash and message; Actions run log |
Low. Upload key is shared, so an out-of-band upload is attributable only by its claimed commit |
| P1/P2 |
Who used terraform-apply or terraform-ci |
GCP audit logs name the WIF principal with repository and ref |
Low |
| DFD |
Threat |
Control |
Residual |
| D1/P1 |
Workflow exfiltrates Secret Manager |
Plans read only the plan inputs (secretAccessor on local.terraform_ci_plan_secrets); secretmanager.admin sits with terraform-apply, which only main can assume |
High, accepted. A PR plan can read the plan inputs, which include write-capable provider tokens (finding 4) |
| E2 |
Tokens read off the device |
iOS Keychain mirror is AFTER_FIRST_UNLOCK in a shared access group |
Medium. AsyncStorage is the source of truth, unencrypted on Android, and holds a 180-day refresh token. An extracted token is a full session |
Denial of service
| DFD |
Threat |
Control |
Residual |
| P4 |
Bad bundle bricks the app |
npm test gates the publish; dashboard rollback behind oauth2-proxy |
Low-Medium. Rollback needs an operator |
| P4 |
Upload flood |
Upload key |
Low |
Elevation of privilege
| DFD |
Threat |
Control |
Residual |
| P2/D2 |
A CI identity grants itself or others more |
Only terraform-apply holds projectIamAdmin, serviceAccountAdmin and workloadIdentityPoolAdmin, and only terraform-apply.yml on main can assume it. terraform-ci holds read roles only |
Low. A push to main applies; see finding 3 |
| P1/D1 |
Plan run gains Cloudflare, GitHub or Tailscale write |
Tokens read from Secret Manager at plan time; fork PRs get no OIDC token |
High, accepted. One credential per provider serves plan and apply, so plans load write-capable tokens and any branch push can change DNS, Access, the tailnet policy or GitHub settings (finding 4) |
Findings and recommendations
Ordered by priority: open, then accepted.
- Server-side OTA signing (Medium). Sign bundles in CI with a key Xavia never sees, or accept and correct the app's comment. Give dev its own signing key and cert.
- Mobile token storage (Medium). Make Keychain (iOS) and Keystore-backed storage (Android) the source of truth for refresh tokens.
- No branch protection (High, accepted; registered under Secrets & Supply Chain). GitHub Free on private repos has no branch protection or rulesets, so a second writer's review on both repos'
main is convention only. Mitigations: repo write is limited to the team, admin comes only from the org role, and applies run only from main. Keep writer lists short and reviewed quarterly with Access Control.
- Plans load write-capable Cloudflare, Tailscale and GitHub credentials (High, accepted). One credential per provider serves plan and apply, so any branch push can change DNS, Access, the tailnet policy or GitHub settings. Fork PRs get no OIDC token, and repo write is limited to the team.