SecurityThreat model and controls
What an attacker controls, what they can reach, and what stops them.
| Threat | Control |
|---|---|
| Malicious job (PR author, compromised dependency) persists into later jobs | One Firecracker VM per job, terminated afterwards, no reuse (ADR-001). JIT runners accept exactly one job. |
| Job reads another repository's secrets | The runner role is limited to gha/<owner>/<repo>/* and to data tagged with its gha-repo-id, and capped by the boundary, which scopes everything to the role's own repository tags. Even a widened identity policy cannot exceed the boundary, and the RCP of org-guardrails denies cross-repository access to secrets, queues, tables and logs. |
| Job steals the GitHub App key | The key is readable only by the broker role. The secret's resource policy denies everyone else, and the boundary explicitly denies it. |
| Repository deploy role escalates (new role, removed boundary) | iam:CreateRole requires the shared boundary, a name of its own and its own repository tags. Removing a boundary, creating policy versions, users or access keys is denied. |
| Repository claims another repository's identity by changing tags | The boundary only counts gha-repo-id on a role named for that id. A retagged role, for example deploy-B carrying A's id, gets nothing. The boundary stops a repository's own roles from setting or removing gha-repo-id and gha-repo with another value. Other principals in the account are stopped only by the SCP of org-guardrails, which leaves only exempt administrators and the tagger able to set these tags. See IAM design. |
| Workflow obtains another repository's deploy session from the tagger (phase 2) | The tagger takes the repository only from a verified GitHub OIDC token (RS256, JWKS key, exact issuer and audience <prefix>-tagger, time claims). The owner must be allowed and its numeric id must match, the registry entry must match the full name, the token's Environment must equal the entry's, a pinned repository_id must match (no access for a recreated repository of the same name), and each jti works once. Only the tagger can set the gha-* session tags (deploy role trust and SCP). Sessions carry SourceIdentity for CloudTrail. |
| Repository asks the broker for another repository's token | The broker runs the presigned GetCallerIdentity itself (regional STS host only, no SSRF). It requires the role <prefix>-<sha256(repo)[:10]>-control in its own account and an onboarded repository, and scopes the token to that one repository. |
| Job kills other runners | The runner role has no MicroVM permissions. The control role can only Get/Terminate VMs of its own image ARN. |
| JIT config replay or theft | Never in the run payload. Stored as a KMS SecureString under a per-runner name, read and deleted by the VM in /run, and deleted again on cleanup. |
| Forged webhook | Constant-time HMAC-SHA256 check, wrong repository rejected, 1 MB body cap. Optional AWS_IAM mode behind a central ingress with WAF. |
| Data exfiltration from a job | No NAT in the account. All traffic goes through the central egress and its firewall allow-list. MicroVMs use NO_INGRESS; shell and auth tokens are denied by the boundary. |
| Supply chain (runner, Lambda code, actions) | Runner tarball SHA-256 pinned, reproducible builds, SLSA build provenance and SBOM on every release, consumers verify with gh attestation verify, optional Lambda code signing, every action pinned by commit SHA. |
| Secrets in Terraform state | The webhook secret is ephemeral and written with secret_string_wo. The App key is set out of band. State is encrypted with KMS and versioned. The bucket denies uploads that ask for another encryption than SSE-KMS; an upload without the header gets the platform key. |
IdentitiesWho can do what
| Role | Used by | Can | Cannot |
|---|---|---|---|
<prefix>-broker | Token broker (platform) | Read the App key, decrypt with the platform key | Anything else |
<prefix>-deploy-<id> | The repo's deploy workflow (OIDC, Environment runners) | Create and update its own resources within the boundary | Leave its boundary, touch other ids, read the App key |
<prefix>-deploy-entry | Deploy workflows of allowed owners (OIDC, any Environment), phase 2 | Invoke the tagger | Anything else |
<prefix>-tagger | Tagger (platform), phase 2 | Read the registry, record token ids, assume <prefix>-deploy with session tags | Anything else |
<prefix>-deploy | Tagged sessions from the tagger, phase 2 | The same as <prefix>-deploy-<id>, for the repository in its session tags | Act for any repository other than its session tags' |
<prefix>-<id>-control | Dispatcher, sweeper | Claim jobs, write JIT params, run and terminate its own VMs, get tokens from the broker | Read job secrets |
<prefix>-<id>-webhook | Webhook | Read the webhook secret, send to its queue | Anything else |
<prefix>-<id>-runner | Every job (ambient) | Read and delete its JIT param, read repo CI secrets and parameters, write runtime logs | MicroVM APIs, other repos, App key |
Rule for workflow authors: the runner role is available to every job, including pull requests from anyone with write access. Keep only CI-grade secrets under gha/<owner>/<repo>/. For deployments use GitHub OIDC with roles whose trust is bound to a protected Environment (repo:<owner>/<repo>:environment:production).
Hardening checklistBefore production
- Use private or internal repositories. For public ones, require approval for all outside contributors and never use
pull_request_targeton these runners. - Restrict the central egress firewall to GitHub, your package registries and AWS endpoints.
- Prefer
webhook_auth_type = "AWS_IAM"behind a central API Gateway with WAF if your SCPs forbid public Function URLs. - Enable Lambda code signing (
code_signing_config_arn) and signlambda.zipwith AWS Signer. - Set an organisation permissions boundary on the platform roles (
permissions_boundary_arn). - Attach the SCP, RCP and tag policy of
org-guardrailsto the runner accounts, on one test account first. - Rotate the webhook secret by bumping
webhook_secret_version. Rotate the GitHub App key yearly in GitHub, then update the secret. - Install the GitHub App only on onboarded repositories.