Skip to content

feat(policies): AMI-launch gating SCPs (provabl#13, slice 1) - #18

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/ami-launch-gating-scp
Jun 11, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/ami-launch-gating-scp

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Layer-1 IAM enforcement for the AMI-gating epic (#13): only vetted AMIs may launch, and only the vetter may mark one vetted. Mirrors the existing nitro SCP pattern; no new deps; unit-tested.

Two SCPs

  • ami_launch_gating_scp.json — Deny ec2:RunInstances unless the AMI carries ec2:ResourceTag/attest:vetted == "true". The Deny is scoped to the image ARN (arn:aws:ec2:*::image/*) — the one non-obvious correctness point: a Resource:"*" scope evaluates the ResourceTag condition against the instance/volumes/ENIs RunInstances also creates (none carry the AMI tag) and would deny every launch.
  • ami_vetting_lockdown_scp.json — Deny ec2:CreateTags/DeleteTags of the attest:vetted key on AMIs for everyone except the vetter (ArnNotLike aws:PrincipalArn). Solves the "trust trap": a researcher can't self-mark an AMI vetted (same "appraised, not asserted" principle as qualify#32's locked attest:* tags). The vetter ARN is a deploy-time placeholder ground/vendor substitutes per account (SCPs can't parameterize).

Tests

Mirror TestNitroAttestationSCPRequiresAttestedTag, with regression guards for the two failure modes that would silently defeat the gate — the image-scope on the launch gate and the vetter exception on the lockdown. Verified both guards fail when violated and pass when correct.

Scope

Layer-1 (enforcement) only. The runtime half (an instance proving it booted the vetted image via PCR0) already exists in nitro/nitrotpm. Deferred follow-ups, tracked on the epic: vet writing attest:vetted (AMI vetting — carries the golden-PCR0 + CVE-source open questions), and vendor deploying these SCPs into vended accounts.

Refs: #13

Layer-1 IAM enforcement for the AMI-gating epic: only vetted AMIs may launch,
and only the vetter may mark one vetted.

- ami_launch_gating_scp.json — Deny ec2:RunInstances unless the AMI carries
  ec2:ResourceTag/attest:vetted == "true". Deny scoped to the image ARN
  (arn:aws:ec2:*::image/*) so the tag condition evaluates only against the AMI;
  a Resource:"*" scope would also match the instance/volumes/ENIs the call
  creates (which lack the tag) and deny every launch.
- ami_vetting_lockdown_scp.json — Deny CreateTags/DeleteTags of the
  attest:vetted key on AMIs except the designated vetter (ArnNotLike
  aws:PrincipalArn). Solves the trust trap: a researcher can't self-mark an AMI
  vetted (same principle as qualify#32's locked attest:* tags). Vetter ARN is a
  deploy-time placeholder ground/vendor substitutes per account.
- Tests mirror the nitro SCP test, with regression guards for the image-scope
  and the vetter exception (verified both fail when violated).

The runtime half (PCR0 proving the booted image) already exists in
nitro/nitrotpm. Deferred follow-ups: vet writing attest:vetted (AMI vetting),
and vendor deploying these SCPs into vended accounts.

Refs: #13
@scttfrdmn
scttfrdmn merged commit 9083ea4 into main Jun 11, 2026
2 checks passed
@scttfrdmn
scttfrdmn deleted the feat/ami-launch-gating-scp branch June 11, 2026 17:29
scttfrdmn added a commit to provabl/vet that referenced this pull request Jun 11, 2026
vet becomes the producer for ground's AMI-launch-gating SCP (slice 1,
provabl/ground#18): `vet gate ami-… --tag-vetted` writes attest:vetted=true
to the AMI via the EC2 API when the gate passes. That tag is exactly what
ground's SCP requires to permit ec2:RunInstances; the companion lockdown SCP
restricts who may set it, so the principal running this is the designated
vetter. Fail-closed: a failing gate writes no tag.

- internal/amitag: an injectable Tagger seam (AWS EC2 CreateTags in prod, a
  fake in tests), mirroring nitro's IAMTagger. Adds aws-sdk-go-v2 + service/ec2.
- cmd/vet gate: ami- target branch + --tag-vetted/--region; tagIfVetted is a
  small pure seam so the pass→tag / fail→no-tag decision is unit-tested without
  driving the os.Exit path.
- Tests: pass writes the tag, fail writes nothing (fail-closed, guard-verified),
  nil tagger never tags, tagger error propagates, ami- detection.

Validated end-to-end on real AWS: vet gate --tag-vetted wrote attest:vetted=true
to a real AMI (confirmed via describe-images); all resources torn down.

v1 asserts provenance/verdict + an authenticated vetter marking — not a deep
image-content guarantee. Deep AMI scanning (Inspector / snapshot+syft) and the
runtime golden-PCR0 binding are deferred (README + #13).

Refs: #13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant