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.
| Layer | What it proves | Command | Needs | Last result |
|---|---|---|---|---|
| Go unit tests | Webhook 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 refresh | just test | Go | 49 tests and subtests pass, race detector on |
| Static checks | Formatting, go vet, golangci-lint, govulncheck, terraform validate of every module and example, tflint, checkov | just check, golangci-lint run ./..., tflint --recursive, checkov -d modules | Go, Terraform | 0 issues · checkov 378 passed, 0 failed |
| Reproducible build | Release binaries cross-build for arm64 and x64; zips are written deterministically (cmd/zipdet: fixed timestamps and Unix modes, also on Windows) | just release-assets | Go | CI green |
| IAM simulation | The account boundary and the SCP allow a repository its own resources and deny everything else, with Access Analyzer on every document | just iam-sim | AWS credentials, read-only APIs, nothing deployed | 92 of 92 cases pass, Access Analyzer clean on 5 documents |
| Guardrails live | The SCP and RCP attached to an OU deny a repository principal with administrator rights everything outside its tags, its boundary and the platform rules | just guardrails-test | The organization's management account and a member account | 18 of 18 SCP checks pass RCP and SQS checks wait for the new account's services |
| Sandbox smoke | A 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 token | just sandbox-smoke | The sandbox | 6 of 6 |
| End to end | A 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 alone | just sandbox-e2e | The sandbox and the test repository | 37 of 37 · tagger only 20 of 20 |
| Deploy as the repository | The 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, alarms | just sandbox-realjob <repo> deploy / destroy | The sandbox in repository mode | apply 4m35s, destroy 2m16s |
| Real job | GitHub 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 terminates | just sandbox-realjob <repo> job | The sandbox, the test repository and a GitHub App | passed: 31 s from queued to running |
| Resilience drills | Capacity 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-webhooks | A deployed repository | 3 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:
- Access Analyzer
ValidatePolicyon each of the five documents. Errors and security warnings fail the run. The entry role's wildcardsubwarning is expected and labelled as such: the tagger checks the repository. iam:SimulateCustomPolicywith the request context of each case: principal ARN, principal tags, request tags, tag keys, resource tags and permissions boundary.
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.
- Pin the test repository (required):
export TF_VAR_github_ids='{owner_id=<id>,repository_id=<id>}', fromgh 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. - Up:
just sandbox-up <owner/repo> eu-central-1 false(falsewhen the account already has the GitHub OIDC provider). About 15 minutes, mostly the image build. - Smoke:
just sandbox-smoke eu-central-1, thenaws logs tail <log_group> --since 15mfor the VM's own log. - End to end:
just sandbox-e2e <owner/repo>(next section). - Down, always:
just sandbox-down <owner/repo> eu-central-1 false. Then check that nothing taggedpurpose=microvm-runner-sandboxis 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
| Check | Expected | Path |
|---|---|---|
| Tagger with a token for the STS audience | denied | phase2 |
| Tagger with the right token | session issued | phase2 |
| The same token again | denied (replay) | phase2 |
| The session is the expected deploy role | deploy-<id> or deploy with a <id>-<run> session | both |
| Read own registry entry, platform configuration | allowed | both |
| Write and delete an object under own state prefix | allowed | both |
| Create a role of its own (boundary, own tags), then delete it | allowed | both |
| Another repository's registry entry or state prefix | denied | both |
| Create a role without the boundary, with foreign tags, or named for another repository | denied | both |
| Retag its own role to another repository, remove its boundary | denied | both |
| Invoke the tagger, update the broker, read the GitHub App key | denied | both |
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:
- 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 asinfra/runners, and this working tree's modules. - deploy: the repository's
deploy.ymltakes a tagged session from the tagger, downloads the assets with it, and runsterraform apply: image, functions, queues, table, schedule and alarms. - webhook: the repository webhook for
workflow_jobevents, with the stack's secret. - job:
job.ymlruns on[self-hosted, linux, arm64, microvm]. It prints the VM, reads its role through IMDSv2, and runsdocker run hello-world. - destroy as the repository, then
unhookandsandbox-down. The order matters: the repository's stack reads the platform configuration even to destroy itself.destroy-localis 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
| Test | Result |
|---|---|
| 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 job | Runner 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 = 5 | 5 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-job | GitHub ended the job, Lost counted 1, and the re-run succeeded. |
| Lost webhooks: webhook removed, job queued | The 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.
| Rule | Checks | Result |
|---|---|---|
| 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 tags | Tagger: allowed. Untagged principal: denied. Repository principal, even with its own values: denied. | 3 of 3 |
| Boundary, escalation and platform roles | Create 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 SQS | Read a queue tagged A or B; create and retag queues | pending: 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 administrators | The service looks the VM up before it authorizes, so without a VM the answer is ResourceNotFound | inconclusive 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 by | Problem | Fix |
|---|---|---|
| Deploy as the repository | The 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 repository | Destroying 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 repository | An 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 teardown | sandbox-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 end | New 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 end | The 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 simulation | The 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 Analyzer | sts:SetSourceIdentity doesn't support aws:RequestTag, so those conditions would have been ignored for it. | Its own trust statement. |
| Sandbox | Connector operator trust, KMS key policy for the MicroVM service, boundary size, image build dependencies. | See the CHANGELOG. |
08 · GapsNot covered yet
- The RCP and the SQS tag checks, live: they wait until the new member account's services are active.
- The MicroVM shell-token denial, live: it needs a running VM in the member account.
- The broker-outage and fallback drills: documented as manual steps on the operations page.
- The boundary is at 6,042 of IAM's 6,144 characters. About 100 characters remain; a larger permission must replace or merge existing entries.
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.