Skip to content

feat: AMI vetting — write attest:vetted on a passing gate (provabl#13) - #22

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/ami-vetting
Jun 11, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/ami-vetting

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Makes vet 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 — exactly the tag 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 (vet's CI). The producer→SCP loop now closes.

What's here

  • 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. Fail-closed: a failing gate writes no tag. tagIfVetted is a small pure seam so the pass→tag / fail→no-tag decision is unit-tested without the os.Exit path.
  • Tests — pass writes the tag, fail writes nothing (fail-closed, verified the guard fails when removed), nil tagger never tags, tagger error propagates, ami- detection.

Validated on real AWS

Ran vet gate ami-… --tag-vetted from an SSM-driven instance (the vetter principal) against a throwaway AMI; describe-images confirmed attest:vetted=true landed. All resources torn down (<~$1).

Scope (honest, v1)

Asserts the AMI's provenance/verdict + an authenticated vetter marking — not a deep image-content guarantee. Deep AMI scanning (Inspector / EBS-snapshot→syft) is a pluggable source recorded via the existing --check-cves/SBOM path; the runtime golden-PCR0 binding is separate, later work (measured-boot PCRs aren't computable offline from an AMI). See README + #13.

Refs: #13

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
@scttfrdmn
scttfrdmn merged commit 4ccfbca into main Jun 11, 2026
1 check passed
@scttfrdmn
scttfrdmn deleted the feat/ami-vetting branch June 11, 2026 19:02
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