Skip to content

Threat Model: Secrets & Supply Chain

Created 2026-08-09
Last reviewed 2026-10-13
Next review due 2027-04-13 (6-month cadence, or on any change to secret sync, CI identity, image build, or release flow)
Reviewers Platform owner
Version 2.2
Surface owner Platform / DevOps

Scope: how secret values reach workloads, how CI gets cloud credentials, and how code and images reach prod. Covers GCP Secret Manager + External Secrets, GitHub Actions WIF into terraform-ci, terraform-apply and tomoda-release, the three first-party GitHub Apps, GHCR images, Argo CD delivery, OTA publish, and native builds.

For how these work, see Secrets Management, IAM, GCP, GitHub, Terraform CI/CD and ARC runners.

Platform constraint that shapes every row: the repos are private on GitHub Free, so branch protection, rulesets and environment protection rules are unavailable. Any principal with write access can push main, and every Actions secret is readable by a workflow on any branch.

Data flow diagrams

Path 1: secret sync (Secret Manager to pod)

flowchart LR
    E1([E1 · Operator]) -->|F1 gcloud secrets versions add| D1
    subgraph gcp[trust boundary: GCP project development-485000]
        D1[(D1 · Secret Manager<br/>63 containers, values by hand)]
    end
    subgraph cluster[trust boundary: k3s cluster]
        D2[(D2 · gcpsm-credentials<br/>eso-reader SA key)]
        P1[P1 · ESO<br/>ClusterSecretStore gsm-tomoda]
        D2 -->|F2 static key| P1
        P1 -->|F3 secretAccessor, project-wide| D1
        P1 -->|F4 materialize, 1h refresh| D3[(D3 · K8s Secrets)]
        D3 -->|F5 env / volume| P2[P2 · workloads]
    end

Path 2: CI identity and Terraform

flowchart LR
    E2([E2 · repo writer<br/>human or App]) -->|F6 push branch / open PR / push main| D4[(D4 · tomoda-labs/devops)]
    subgraph gha[trust boundary: CI runner, plan on ARC tomoda-arc, apply GitHub-hosted]
        P3[P3 · terraform-plan / apply<br/>runs the ref's own workflow file]
    end
    D4 -->|F7 trigger| P3
    subgraph gcp[trust boundary: GCP]
        P4[P4 · WIF pool github-actions<br/>repository condition]
        P5[P5 · terraform-ci SA<br/>read-only, plan inputs]
        P11[P11 · terraform-apply SA<br/>projectIamAdmin, secretmanager.admin, ...]
        D1[(D1 · Secret Manager)]
        D5[(D5 · tfstate bucket)]
    end
    P3 -->|F8 OIDC token| P4
    P4 -->|F9 plan, any ref| P5
    P4 -->|F22 apply, terraform-apply.yml on main only| P11
    P5 -->|F10 read plan-input secrets| D1
    P11 -->|F11 state r/w| D5
    P11 -->|F12 apply| E3([E3 · GCP, Cloudflare, GitHub, Tailscale APIs])

Path 3: build, release and delivery

flowchart LR
    E2([E2 · repo writer]) -->|F13 push / dispatch| P6
    subgraph gha[trust boundary: GitHub Actions]
        P6[P6 · images.yml / release.yml / ota.yml]
        D6[(D6 · repo Actions secret<br/>XAVIA_DEV_UPLOAD_KEY)]
        D6 --> P6
    end
    subgraph gcp[trust boundary: GCP]
        P12[P12 · WIF pool github-actions-tomoda<br/>tomoda main only]
        P13[P13 · tomoda-release SA]
        D8[(D8 · release App key<br/>prod OTA upload key)]
    end
    P6 -->|F23 OIDC token, release.yml / ota.yml on main| P12
    P12 --> P13
    P13 -->|F24 secretAccessor on two secrets| D8
    D8 --> P6
    P6 -->|F14 push tag, GITHUB_TOKEN packages:write| D7[(D7 · GHCR)]
    P6 -->|F15 tomoda-release App: deploy PR| D4[(D4 · devops main)]
    P6 -->|F16 upload key| P9
    subgraph cluster[trust boundary: k3s cluster]
        P7[P7 · Argo CD<br/>auto-sync, selfHeal]
        P8[P8 · image-updater<br/>dev-* tags, dev only]
        P9[P9 · Xavia OTA server]
        P10[P10 · ARC runners tomoda-arc, tomoda-arc-db, tomoda-arc-trusted]
    end
    D4 -->|F17 desired state| P7
    D7 -->|F18 pull by tag, Always| P7
    P8 -->|F19 newest dev-* tag| P7
    P9 -->|F20 JS bundle| E4([E4 · app installs])
    E5([E5 · developer Mac]) -->|F21 native build, signing secrets| E6([E6 · App Store / Play])

DFD elements

Ref Type Element Notes
E1 External Operator Sets secret values by hand
E2 External Repo writer Humans and Apps with write; see Assets
E5 External Developer Mac Only native build path; no native CI
P1 Process External Secrets Operator k8s/envs/platform/manifests/external-secrets-config.yaml
P3 Process Terraform workflows .github/workflows/terraform-{plan,apply}.yml
P4 Process WIF provider infrastructure/gcp/wif.tf
P5 Process terraform-ci infrastructure/gcp/service_accounts.tf; read roles only, used by plans
P11 Process terraform-apply infrastructure/gcp/service_accounts.tf; bound to terraform-apply.yml on main (wif.tf)
P6 Process Build/release workflows tomoda .github/workflows/{images,release,ota}.yml, devops .github/workflows/images.yml
P7 Process Argo CD Applications in project default, automated sync with selfHeal
P8 Process argocd-image-updater k8s/envs/platform/manifests/image-updater.yaml
P10 Process ARC runner scale sets (tomoda-arc, tomoda-arc-db, tomoda-arc-trusted) k8s/envs/platform/arc-runners*/values.yaml
P12 Process tomoda WIF provider infrastructure/gcp/wif.tf; repository == tomoda-labs/tomoda and ref == refs/heads/main
P13 Process tomoda-release infrastructure/gcp/service_accounts.tf; bound to tomoda release.yml, ota.yml and devops notify-prod-deploy.yml on main
D1 Store Secret Manager infrastructure/gcp/secrets.tf, prevent_destroy
D2 Store external-secrets/gcpsm-credentials Created by scripts/ovh/bootstrap-argocd.sh
D5 Store tomoda-tfstate Versioned, infrastructure/gcp/storage.tf
D8 Store tomoda-release-app-private-key, tomoda-ota-prod-upload-key In D1; readable by tomoda-release, eso-reader and project owners
D7 Store GHCR tomoda-backend, tomoda-frontend, tomoda-postgres, tomoda-arc-runner, xavia-ota

Assets and trust boundaries

Asset Where Why it matters
terraform-apply WIF, terraform-apply.yml on main only projectIamAdmin + secretmanager.admin + serviceAccountAdmin + workloadIdentityPoolAdmin: owner-equivalent on the project
terraform-ci WIF, any devops ref Read-only in GCP; reads the plan inputs, which include write-capable provider tokens
eso-reader key D2 Reads every secret in D1
tomoda-release App key D8, read through WIF by release workflows on main contents:write on devops; can push main
tomoda-terraform App key D1 administration:write, members:write on all repos
tomoda-ci-automation App key D1, synced to arc-runners, trivy-issue-reporter, Argo repo secret administration:write, organization_self_hosted_runners:write
OTA prod upload key D8, read through WIF by ota.yml on main Ships JS to every prod install
Native signing material D1 (tomoda-ios-match-passphrase, tomoda-android-*, tomoda-asc-api-key, tomoda-play-service-account), GCS tomoda-ios-certs Signs and publishes store binaries

Who has write. Teams Core, Infra and App-dev and the outside collaborators hold write on their repos; repo admin comes only from the org owner role. Membership and grants are in infrastructure/github/access.tf; check the live repo collaborator list when auditing.

Installed Apps that can write code: tomoda-release (selected repos, contents:write), claude (all repos, contents + workflows write), google-labs-jules (selected, contents + workflows write), cloudflare-workers-and-pages (selected, contents + administration write). Org 2FA is not required. allowed_actions = "all", default_workflow_permissions = "read" (infrastructure/github/repos.tf).

STRIDE

Spoofing

Ref Threat Mitigation Residual
F8, F9, F22 A devops workflow run gets owner-equivalent GCP access Provider condition pins assertion.repository == 'tomoda-labs/devops'; forks and other repos rejected. terraform-apply is bound through job_workflow_ref to terraform-apply.yml on refs/heads/main (infrastructure/gcp/wif.tf); PR runs, other branches, workflow_dispatch on a branch and other workflow files get only read-only terraform-ci Low. A push to main applies; see the accepted branch-protection finding
F2 Stolen eso-reader key used off-cluster Key exists only in D2; no key in git Medium. Static key, expiry 9999-12-31; usable from anywhere
F15, F23 A tomoda branch or PR run reads the tomoda-release key Key lives only in Secret Manager. 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 (infrastructure/gcp/wif.tf); devops binds only notify-prod-deploy.yml on main. App tokens are minted per job and scoped by repositories Medium. A writer who pushes tomoda main runs as tomoda-release; see the accepted branch-protection finding

Tampering

Ref Threat Mitigation Residual
F6, F17 Direct push to devops main deploys to prod and runs terraform apply Review by convention; repo write limited to the team; admin only from the org role; Argo selfHeal reverts drift to main only High, accepted. Free plan: no branch protection, no environment gate (terraform-apply.yml comment)
F14, F18 Re-pushed GHCR tag replaces a prod image Workflows skip a tag that already exists (images.yml imagetools inspect); provenance attestation attached by docker/build-push-action Medium. Skip is in-workflow only, tags are mutable, prod pins tag not digest, imagePullPolicy: Always (k8s/apps/tomoda/base/*-deployment.yaml). Attestation is never verified
F19 Any dev-* tag auto-deploys to dev Dev only; prod moves only by deploy PR Low. A branch workflow can push dev-x to GHCR
F16, F20 Malicious OTA bundle to prod Prod upload key only through WIF on main (F23); ota.yml also checks refs/heads/main and that devops pins the tag Medium. A push to tomoda main can edit ota.yml; see Release Integrity
P6 Compromised third-party action Dependabot github-actions weekly in both repos; dataaxiom/ghcr-cleanup-action SHA-pinned Medium. Every other action is a mutable tag; aquasecurity/trivy-action@master (.github/workflows/infra-lint.yml) tracks a branch
P10 PR job poisons shared runner cache Runners are ephemeral pods, maxRunners: 3 Medium. hostPath /var/cache/tomoda-ci (mode 777) is shared across all jobs and repos on the node, including PR jobs (backend-ci.yml, frontend-ci.yml)
D1 Dependency CVE in source Dependabot: tomoda gomod, npm, github-actions; devops terraform, github-actions. Trivy operator scans running images (HIGH, CRITICAL) and files issues Medium. devops Dependabot terraform covers only /infrastructure/cloudflare. Trivy IaC scan is exit-code: '0'; no image scan before push

Repudiation

Ref Threat Mitigation Residual
F1 Who changed a secret value Secret Manager admin activity logs version adds Low
F6 Who pushed main Git history, GitHub audit log Low
E5 Which build a store binary came from Fastlane runs on one Mac Medium. No CI log or attestation for native builds

Information disclosure

Ref Threat Mitigation Residual
F3 eso-reader reads secrets no cluster workload needs Single role secretmanager.secretAccessor Medium. Project-wide: covers CI-only and native signing secrets (tomoda-github-terraform-app-private-key, tomoda-release-app-private-key, tomoda-ios-match-passphrase, tomoda-android-upload-keystore, tomoda-play-service-account)
P1 Any namespace pulls any secret ExternalSecrets land via Argo from devops main only Medium. gsm-tomoda is a ClusterSecretStore with no conditions; reachable from every namespace
F10 PR code exfiltrates provider secrets ::add-mask:: on values; terraform-ci reads only local.terraform_ci_plan_secrets (infrastructure/gcp/service_accounts.tf) High, accepted. Plan job reads the Cloudflare API token, asset signing keys, Tailscale OAuth secret, alert webhook and tomoda-terraform App key into PR-branch code; registered under Release Integrity
D6 Branch workflow reads tomoda Actions secrets Release App key and prod upload key are not repo secrets (D8); default_workflow_permissions = "read" Low. The one repo secret left, XAVIA_DEV_UPLOAD_KEY, reaches every branch and publishes to dev only
P8 image-updater reads every cluster Secret Runs in argocd Low. ClusterRole grants secrets get/list/watch cluster-wide; it needs one
P2 Grafana admin login Fronted by oauth2-proxy (auth.proxy); admin password from the grafana-admin-credentials ExternalSecret (k8s/envs/platform/monitoring/values.yaml) Low. Login form stays on
E5 Signing material on a laptop Per-secret secretAccessor and tomoda-ios-certs read for native releasers only (infrastructure/gcp/people.tf); tomoda-ios-certs has public access prevention Medium. Secrets land in the developer's shell

Denial of service

Ref Threat Mitigation Residual
D1 Secret container deleted prevent_destroy on every container Low
D7 Retention deletes a live tag ghcr-cleanup.yml deletes untagged only, validate: true; manual runs default to dry run Low
F2 eso-reader key revoked or rotated badly Synced K8s Secrets persist Low. Value changes stop syncing until D2 is replaced

Elevation of privilege

Ref Threat Mitigation Residual
P5, P11 devops writer becomes project owner Only terraform-apply holds projectIamAdmin and secretmanager.admin, and only terraform-apply.yml on main can assume it; terraform-ci is read-only Low. A push to main applies; see the accepted branch-protection finding
F15 tomoda writer becomes prod deployer Release App key only on tomoda main (F23); deploy PRs reviewed by convention Medium. A tomoda writer who pushes main can run as tomoda-release and push devops main, which also triggers apply as terraform-apply; see the accepted branch-protection finding
P10 Runner job reaches cluster Values grant the runner no service account or RBAC Medium. Org-scoped pool runs PR code on prod nodes with a writable hostPath
E2 Third-party App writes workflows Installed by an org owner Medium. Two coding-agent Apps hold workflows:write, so they can trigger Path 2

Findings and recommendations

Open first, then accepted; each by priority.

Priority Finding Fix Status
Medium eso-reader: static key with no expiry, project-wide accessor on all 63 secrets; rotation is "yearly" by hand with no reminder (docs/security/iam.md#eso-reader) Bind accessor per secret (or by IAM condition on a cluster-secret prefix) so CI and native secrets are excluded; add a dated rotation runbook entry and an alert on key age; add spec.conditions namespace selectors to gsm-tomoda Open
Medium Prod pins mutable tags with imagePullPolicy: Always; provenance not verified Pin prod by digest in the deploy PR; attest with actions/attest-build-provenance and verify before bumping Open
Medium Actions on tags, trivy-action@master, allowed_actions = "all" Pin all actions to SHAs (Dependabot keeps them current); restrict allowed_actions to selected Open
Medium ARC hostPath cache shared across repos and PR jobs Per-job emptyDir or a cache keyed per repo; keep PR jobs off prod nodes. The trusted pool mounts no hostPath Open
Medium Any org workflow, a PR branch included, can target runs-on: tomoda-arc-trusted (Free plan: one runner group). The prod credentials stay gated by the WIF workflow+main bindings A trusted runner group restricted to selected workflows on a paid plan (docs/kubernetes/system/arc-runners.md#trusted-pool-tomoda-arc-trusted) Open
Medium tomoda ota.yml publish reads the prod OTA upload key on the shared tomoda-arc pool, next to PR jobs and their node cache Move the prod path of publish to tomoda-arc-trusted Open
Medium Terraform Plan runs PR code on the prod node as terraform-ci and reads the plan-input secrets (same exposure as on a hosted runner, plus in-cluster network reach shared with other PR jobs) Plan-only provider tokens where the provider supports them; NetworkPolicy egress limits for arc-runners Open
Medium Native builds and signing on one Mac, no attestation Record build host, commit and binary hash per release Open
Low image-updater ClusterRole reads all Secrets Scope to a Role on argocd/ghcr-image-updater Open
Low devops Dependabot terraform covers only cloudflare Add gcp, gcp-org, github, tailscale directories Open
High No branch protection (GitHub Free): any writer can push devops main, deploying to prod and running apply GitHub Free on private repos has no branch protection or rulesets. Mitigations: repo write is limited to the team, admin comes only from the org role, and applies run only from main. Reassess a paid plan for rulesets Accepted
High Org 2FA not required The owner chose not to require org 2FA; members without 2FA would be removed from the org. Mitigations: repo access comes through teams, admin only through the org role, and applies run only from main. Accepted