MicroVM GitHub Runners
Last full run · 2026-11-22

How it is tested,
and what to start from

Ten layers of tests. The first three run on every push and cost nothing. The rest need AWS:

01 · LayersFrom a unit test to a real workflow

Each layer catches what the one before cannot. Policy simulation catches what unit tests cannot see, and a real GitHub token catches what a simulation cannot model.

LayerWhat it provesCommandNeedsLast result
Go unit testsWebhook HMAC and repository checks, dispatcher and sweeper state machine, broker caller checks, the tagger's token checks (algorithm, key, issuer, audience, time claims, owner and owner id, registry, environment, pinned repository id, replay), JWKS refreshjust testGo49 tests and subtests pass, race detector on
Static checksFormatting, go vet, golangci-lint, govulncheck, terraform validate of every module and example, tflint, checkovjust check, golangci-lint run ./..., tflint --recursive, checkov -d modulesGo, Terraform0 issues · checkov 378 passed, 0 failed
Reproducible buildRelease binaries cross-build for arm64 and x64; zips are written deterministically (cmd/zipdet: fixed timestamps and Unix modes, also on Windows)just release-assetsGoCI green
IAM simulationThe account boundary and the SCP allow a repository its own resources and deny everything else, with Access Analyzer on every documentjust iam-simAWS credentials, read-only APIs, nothing deployed92 of 92 cases pass, Access Analyzer clean on 5 documents
Guardrails liveThe SCP and RCP attached to an OU deny a repository principal with administrator rights everything outside its tags, its boundary and the platform rulesjust guardrails-testThe organization's management account and a member account18 of 18 SCP checks pass RCP and SQS checks wait for the new account's services
Sandbox smokeA MicroVM starts like the dispatcher starts it (VPC egress, NO_INGRESS, KMS), its role reaches SSM, it terminates. The tagger reaches GitHub's keys and refuses a forged tokenjust sandbox-smokeThe sandbox6 of 6
End to endA real GitHub Actions workflow signs in through GitHub OIDC on both deploy paths and runs allow and deny checks against real AWS. With per_repository_deploy_roles = false, the tagger path alonejust sandbox-e2eThe sandbox and the test repository37 of 37 · tagger only 20 of 20
Deploy as the repositoryThe test repository applies and destroys the consumer example itself, through the entry role, the tagger and the shared deploy role, so every call runs under the boundary: image build, functions, queues, table, schedule, alarmsjust sandbox-realjob <repo> deploy / destroyThe sandbox in repository modeapply 4m35s, destroy 2m16s
Real jobGitHub sends a workflow_job webhook. The dispatcher gets a token from the broker (registry lookup, GitHub App) and starts a MicroVM with its own role. The JIT runner runs the job, Docker included, and the VM terminatesjust sandbox-realjob <repo> jobThe sandbox, the test repository and a GitHub Apppassed: 31 s from queued to running
Resilience drillsCapacity exhaustion, a VM killed mid-job, lost webhooks (DORA Art. 24–25). Broker outage and fallback stay manual (operations page)just sandbox-realjob <repo> drill-capacity, drill-vm-failure, drill-lost-webhooksA deployed repository3 of 3

CI (.github/workflows/ci.yml) runs the first three layers on every push and pull request, plus checkov with SARIF upload to code scanning. The release workflow adds the SBOM and SLSA build provenance. The AWS layers run from a laptop with an SSO profile: the project has no CI role in AWS on purpose.

02 · IAM simulationAWS's policy engine, without deploying

tools/iamsim renders the real documents offline: the account boundary, the trust policies of the shared deploy role and the entry role, the SCP and the RCP. cmd/iamsim then sends them to two read-only APIs:

Own resources: allowed

Functions, MicroVM image and VMs, queues, tables, log groups, parameters, platform secrets, gha/<owner>/<repo>/ job data, data tagged with its id, its state prefix, roles of its own with the boundary and its tags, the broker.

Another repository: denied

The same list for repository B, B's registry entry, roles named or tagged for B, tagging B's function with A's id.

The platform: denied

Broker and tagger functions, the tagger's replay table, the GitHub App key, writing the registry, shell tokens, removing a boundary, editing the shared deploy role.

Stolen tags: denied

Deploy-B or a runtime role of B carrying A's tags, an unrelated role tagged as A, the entry and tagger roles tagged as A. Tags only count on a role named for them.

SCP: the tagger alone

Only the tagger may set gha-* session tags. Other session tags stay allowed. Only administrators change the platform roles.

Size

The boundary must stay under IAM's 6,144-character limit, whatever the number of repositories: 6,028 today. Terraform also refuses a plan above it.

# read-only: SimulateCustomPolicy and ValidatePolicy, nothing is created
just iam-sim
# or print the requests without calling AWS
terraform -chdir=tools/iamsim output -json policies | go run ./cmd/iamsim -dump

03 · SandboxA throw-away landing zone in one account

examples/sandbox stands in for the landing zone with a small VPC and one NAT gateway (about $1–2 a day). It applies bootstrap with the tagger enabled, builds the runner image, and deploys one repository. Every resource is tagged purpose=microvm-runner-sandbox.

  1. Pin the test repository (required): export TF_VAR_github_ids='{owner_id=<id>,repository_id=<id>}', from gh api repos/<owner>/<repo> --jq '.owner.id,.id'. New repositories sign in with the immutable OIDC subject, and the deploy role and the tagger owner need these ids.
  2. Up: just sandbox-up <owner/repo> eu-central-1 false (false when the account already has the GitHub OIDC provider). About 15 minutes, mostly the image build.
  3. Smoke: just sandbox-smoke eu-central-1, then aws logs tail <log_group> --since 15m for the VM's own log.
  4. End to end: just sandbox-e2e <owner/repo> (next section).
  5. Down, always: just sandbox-down <owner/repo> eu-central-1 false. Then check that nothing tagged purpose=microvm-runner-sandbox is left: the tagging API keeps stale ARNs for a while, so look each one up. KMS keys stay pending deletion for 7 days and aren't billed meanwhile.

On Windows, prefix the recipes with win:: (PowerShell 7).

04 · End to endA real GitHub workflow, both deploy paths

just sandbox-e2e copies examples/sandbox/e2e/e2e.yml and e2e-checks.sh to the test repository, creates its runners Environment, and dispatches the workflow with the sandbox's outputs. Two jobs run in parallel on GitHub-hosted runners:

phase1 · per-repository role

configure-aws-credentials assumes gha-microvm-deploy-<id> with GitHub's OIDC token. The session must be that role.

phase2 · entry role and tagger

The job assumes gha-microvm-deploy-entry, asks GitHub for a second token with audience gha-microvm-tagger, and exchanges it with the tagger for a session of gha-microvm-deploy tagged with the repository.

Checks

CheckExpectedPath
Tagger with a token for the STS audiencedeniedphase2
Tagger with the right tokensession issuedphase2
The same token againdenied (replay)phase2
The session is the expected deploy roledeploy-<id> or deploy with a <id>-<run> sessionboth
Read own registry entry, platform configurationallowedboth
Write and delete an object under own state prefixallowedboth
Create a role of its own (boundary, own tags), then delete itallowedboth
Another repository's registry entry or state prefixdeniedboth
Create a role without the boundary, with foreign tags, or named for another repositorydeniedboth
Retag its own role to another repository, remove its boundarydeniedboth
Invoke the tagger, update the broker, read the GitHub App keydeniedboth

Run twice on 2026-11-21 from aws-abaschen/microvm-runner-sandbox, the second time after pinning the owner id in the entry role: 3 tagger checks and 17 per path, 37 in all, every one passing.

05 · Real jobsA repository deploys its runners, then runs jobs on them

The sandbox in repository mode (TF_VAR_runners_deployed_by=repository) holds only the platform. cmd/realjob does the rest from the operator's machine:

  1. prepare: uploads the release assets to the artifacts bucket under the repository's id. It pushes three things to the test repository: the workflows (deploy.yml, job.yml, e2e.yml), the consumer example as infra/runners, and this working tree's modules.
  2. deploy: the repository's deploy.yml takes a tagged session from the tagger, downloads the assets with it, and runs terraform apply: image, functions, queues, table, schedule and alarms.
  3. webhook: the repository webhook for workflow_job events, with the stack's secret.
  4. job: job.yml runs on [self-hosted, linux, arm64, microvm]. It prints the VM, reads its role through IMDSv2, and runs docker run hello-world.
  5. destroy as the repository, then unhook and sandbox-down. The order matters: the repository's stack reads the platform configuration even to destroy itself. destroy-local is the operator fallback.

The GitHub App is created once, by a person, in the organization's settings. Its key goes into the secret microvm-runner-sandbox/github-app with just sandbox-app-key, run by that person. The sandbox copies it into the platform's App secret with an ephemeral read and a write-only argument, so the key is in neither the Terraform state nor the tool output.

Results, 2026-11-22

TestResult
Final cycle (tagger path only, platform dashboard)Tagger probe denied (GitHub's keys reachable). Repository deploy 5m39s, then one job picked up after 19 s, done in 40 s. The gha-microvm-platform dashboard was in place with its Repository selector defaulting to the test repository. Destroy as the repository 2m59s, then sandbox-down: nothing left.
One jobRunner mvm-… picked the job up 31 s after it was queued. The VM is Amazon Linux 2023, aarch64. The job read its runner role from IMDS, Docker 25.0.18 ran hello-world, and the whole run took 1 minute.
Capacity: 7 jobs against max_runners = 55 ran at once. The other 2 waited about 195 s for a free runner and then succeeded. Throttled counted 2.
VM failure: VM terminated mid-jobGitHub ended the job, Lost counted 1, and the re-run succeeded.
Lost webhooks: webhook removed, job queuedThe sweeper started the job 159 s after it was dispatched. Redispatched counted 1. The webhook was then restored.

06 · Guardrails liveSCP and RCP in a member account

SCPs and RCPs never apply to an organization's management account. tools/guardrails therefore creates one member account in its own OU (microvm-guardrails-test), enables the policy types at the root, and attaches the three guardrails to that OU only.

cmd/guardtest reaches the account through OrganizationAccountAccessRole, which is exempt. It creates test principals with AdministratorAccess, so only the organization policies can deny them, and removes them afterwards.

RuleChecksResult
Repository tags carry only the caller's own values (IAM role tags)Tag its own role with its own id: allowed. Tag a role with B's id: denied. Remove the tag: denied. Retag B's role with its own id: denied. An untagged principal tags a role with A's id: denied. The exempt admin retags: allowed.6 of 6
Only the tagger sets repository session tagsTagger: allowed. Untagged principal: denied. Repository principal, even with its own values: denied.3 of 3
Boundary, escalation and platform rolesCreate a role without the boundary: denied. Create one with the boundary and its own tags: allowed. Remove a boundary, create an access key, rewrite the boundary policy, edit the tagger role's trust (repository or untagged principal): denied. Exempt admin: allowed.9 of 9
RCP: no data tagged for another repository, and the same tag rules on SQSRead a queue tagged A or B; create and retag queuespending: SQS isn't active yet in the new account (OptInRequired), which can take up to a day. just guardrails-test completes them then
No MicroVM shell token, even for administratorsThe service looks the VM up before it authorizes, so without a VM the answer is ResourceNotFoundinconclusive live; covered by just iam-sim

The first run, right after attaching the SCP, passed several calls that should have been denied: SCPs take minutes to propagate. Wait a few minutes after guardrails-up. guardrails-down detaches the policies and keeps the account; guardrails-close closes it, after which AWS keeps it suspended for about 90 days.

07 · FindingsWhat the AWS layers caught

Every one of these passed unit tests and terraform validate. Each is now covered by a test.

Found byProblemFix
Deploy as the repositoryThe image is created through Cloud Control, which authorizes its create-time tags as lambda:TagResource on *. The boundary didn't allow that, so no repository could deploy its own image.lambda:TagResource joins CreateMicrovmImage under the same own-id condition. The SCP gains DenyRetagOtherRepository, so a resource that already carries another repository's id can't be retagged.
Destroy as the repositoryDestroying an event source mapping polls lambda:GetEventSourceMapping, which has no lambda:FunctionArn key. Deleting the image artifact in the versioned bucket needs s3:ListBucketVersions and s3:DeleteObjectVersion.The read goes to the unscoped reads. Version listing and deletion are limited to the repository's own prefix.
Deploy as the repositoryAn edit to the boundary put a # comment in the middle of a line. It silently dropped lambda:PassNetworkConnector, GetNetworkConnector and GetCodeSigningConfig, and iam-sim had no case for them.Fixed, with iam-sim cases for each. The IAM simulator itself doesn't map PassNetworkConnector to connector ARNs, so that case runs on *.
Sandbox teardownsandbox-down before the repository's destroy leaves the repository's stack behind. It needs the platform configuration even to destroy itself.Destroy as the repository first. destroy-local as the fallback. The order is documented.
End to endNew GitHub repositories sign in with the immutable subject repo:<owner>@<owner_id>/<repo>@<repository_id>:…. Neither deploy role matched it, so no real deploy could have signed in.Both forms accepted. Optional pinned ids make the trust exact, and the tagger checks the pinned id.
End to endThe bucket policy denied every upload without an aws:kms header, Terraform state included. StringNotEqualsIfExists, like any negated operator, also matches a missing key.Deny only a present, wrong header (Null test plus StringNotEquals). The consumer example drops encrypt = true, which sends AES256.
Access Analyzer (just iam-sim)The first fix for immutable subjects used repo:<owner>@*/…. IAM accepted it and the end-to-end run passed, but Access Analyzer reports a wildcard right after the @ as too permissive: any id would match.Owner and repository ids are pinned instead: tagger_github_owners maps owners to ids, and the tagger checks repository_owner_id.
Review, confirmed by IAM simulationThe boundary's permissions followed the tags, so deploy-B retagged with A's id would act as A.TagMatchesName: a tag only counts on a role named for it.
Access Analyzersts:SetSourceIdentity doesn't support aws:RequestTag, so those conditions would have been ignored for it.Its own trust statement.
SandboxConnector operator trust, KMS key policy for the MicroVM service, boundary size, image build dependencies.See the CHANGELOG.

08 · GapsNot covered yet

09 · SamplesRepositories to start from

Copy the one that matches your role. All of them are in the examples folder, except the live test repository.

bootstrap-account

For the platform team, once per account and Region. Applies bootstrap in a landing-zone VPC without NAT, with central endpoints and egress. Onboards two repositories (one pinned to its GitHub ids) and enables the tagger for an owner. Outputs the deploy roles, the tagger and the App secret to fill in.

consumer-repo

For an application repository. infra/runners holds the runner-image and repo-runner modules and the S3 backend.

deploy-runners.yml: per-repository deploy role, release checksum and attestation checks, plan archived as the change record, apply.
deploy-runners-tagger.yml: the same through the entry role and the tagger.
ci.yml: jobs on [self-hosted, linux, arm64, microvm], with a job secret under gha/<owner>/<repo>/.

sandbox

For trying it out and for testing. A whole landing zone stand-in, bootstrap, image and one repository in a single account, with the smoke test outputs and the end-to-end workflow under e2e/. Costs about $1–2 a day: tear it down after use.

tools/iamsim

For reviewing IAM changes. Renders the boundary, trust policies and guardrails with placeholder ids and checks them with cmd/iamsim. Add a case there with every change to the boundary or the SCP.

microvm-runner-sandbox private

The live test repository in the aws-abaschen organization. It holds what the recipes push: e2e.yml, deploy.yml, job.yml, the consumer example as infra/runners, and its runners Environment. The test GitHub App is installed on it alone. Use any repository of your own the same way: create it, then pass its name and ids to the sandbox recipes.