Repository navigation
Description
Context
The AMI-gating epic (#13) Layer 1 is otherwise shipped: `vet ami-reference` writes the golden `attest:pcr` tags, and `vet gate ami-… --tag-vetted` writes the locked `attest:vetted` tag fail-closed (ground's launch-gating + lockdown SCPs enforce/protect them, adversarially simulator-tested). The runtime binding (nitro/tpm `--expected-from-ami`) is also done.
The one remaining capability gap: `vet gate ami-…` evaluates a pre-existing verification record and writes the tag — but vet does not scan the AMI's own contents. `vet verify ami-…` today treats the AMI ref like any artifact: it looks for a pre-placed SBOM in `.vet/sboms/` and runs OSV against it, but there is no code that inspects the AMI/EBS-snapshot itself. (See `internal/verify/verify.go` — `artifactHash` returns empty for AMI refs; no Inspector/snapshot/syft-on-image path exists. This is deferred-by-design per the current CHANGELOG/README, not a regression.)
So an operator wanting real CVE gating on an AMI must scan it out-of-band and hand-place the SBOM. That's the gap.
Open decision (do first)
CVE/SBOM source for an AMI — two viable approaches, pick one (or make it pluggable):
- Amazon Inspector — fetch findings via the Inspector API for the AMI/instance; convert to the gate's CVE inputs. No snapshot handling; depends on Inspector being enabled.
- EBS snapshot → syft — snapshot the AMI's volume, mount/read it, run syft to generate the SBOM, then the existing OSV path. Self-contained but heavier (snapshot lifecycle, live AWS, IAM).
Both need live AWS and so can't be exercised in CI without real resources — mirror the suite's pattern: small injectable interfaces + fakes for the logic, the live wiring gated/manual.
Scope
- Decide the scan source (Inspector vs snapshot→syft vs pluggable) — security/ops review.
- Implement `vet verify ami-…` to scan the image and populate the verification record (SBOM + CVE), instead of requiring a pre-placed SBOM.
- Unit-test the logic behind injectable interfaces (fake Inspector/EC2); document the live runbook + any new IAM actions in `docs/required-permissions.md`.
- Update CHANGELOG + the AMI-gating notes; cross-link vet verify --check-cves is a no-op: CVE gating silently passes vulnerable artifacts #13.
Explicitly out of scope / non-gaps
- AWS Allowed AMIs as the launch-enforcement primitive — decided against in favor of the per-AMI tag primitive (rationale: `ground/policies/SECURITY.md`; per-AMI granularity vs per-owner coarseness). Not unfinished work.
- Golden-PCR computation — enclave/NitroTPM PCRs cannot be computed offline from an AMI; they're captured from a trusted reference boot (by design).
Tracked under #13.
Activity
scttfrdmn commentedon Jun 25, 2026
Live both-source test (2026-06-25) — both paths exercised against real AWS, then torn down
Ran a real comparison in account
942542972736(us-east-1) on a throwaway t3.micro from stock AL2023 (ami-00948338a4aeec604). All resources taggedephemeral=trueand fully torn down + verified gone (instance terminated, snapshot deleted, Inspector disabled, IAM role/profile removed; anephemeral=truesweep returned empty). Cost: well under $1.Path B — snapshot → syft → OSV
CreateSnapshotworks, fast (seconds to request). ✅rpm -qa, equivalent to syft on the mounted snapshot). ✅/v1/querywith ecosystemLinuxreturns 0 vulns for distro packages (bash 5.2.15,bind-libs 9.18.49,openssl,curlat their AL2023 versions). OSV'sLinuxecosystem is upstream-kernel-scoped, not Amazon-ALAS-aware — so a naive syft→OSV reports a distro AMI as falsely clean. The syft path needs a distro-aware matcher (e.g. Grype with its ALAS feed, or correct ecosystem mapping), not the raw OSV-Linuxpath vet uses today for language packages.Path A — Amazon Inspector v2
ENABLING → ENABLEDtook ~6 min.scanStatus = INACTIVE, reasonUNMANAGED_EC2_INSTANCE. Despite SSM registration, Inspector did not run the package/CVE scan — it needs the instance to be a managed instance (its own SSM-association posture) first, or you use Inspector agentless EC2 scanning, which internally EBS-snapshots the volume (i.e. Inspector's agentless mode is the snapshot path, AWS-managed).Verdict — pluggable source interface is the right call
Linux= false-clean)UNMANAGED_EC2_INSTANCEblocks pkg scanLinux≠ ALASBoth have real, different sharp edges, confirming the two should be pluggable sources behind one interface (as this issue proposed). Notable: Inspector's agentless mode and the syft path converge on the same EBS-snapshot mechanism — so the build could share a snapshot substrate and differ only in the matcher/finding source.
Recommended scope refinement for the build:
CVESourceinterface; impls:inspector(agentless, ALAS-native) andsnapshot+grype(self-contained, ALAS feed).Linuxfor distro AMIs — wire a distro-advisory matcher.feat: extract a pluggable CVE-scanning seam (internal/cve) — #32 slic…
feat: distro-aware CVE source (grype) for AMIs — #32 slice 2 (#34)
feat: AMI content-scan orchestration (internal/amiscan) — #32 slice 3 (…
scttfrdmn commentedon Jun 25, 2026
Status — slices 1–4 merged; slice 5 (live adapters) in progress
The whole architecture and all bug-prone logic is now on
main, fully unit-tested, no AWS in CI:cve.Sourceseam (OSV default)GrypeSource(distro-aware) +vet verify --cve-source auto|osv|gryperoutinginternal/amiscanorchestration + read-only EC2ImageInspector(resolves backing snapshot)Mountervolume-lifecycle core — guaranteed teardown on every failure pathSlice 5 (in progress): the thin live AWS adapters behind the slice-4 seams —
VolumeManager→ EC2CreateVolume(from snapshot) /AttachVolume/DetachVolume/DeleteVolumeRemoteScanner→ SSMSendCommand(mount read-only + syft) + S3 (ferry the SBOM back; a full-AMI SBOM exceeds SSM's inline output cap)Plus
vet verify ami-… --deep-scanwiring so an AMI target runs the snapshot→syft→grype path end to end.Prerequisite for live validation (operator-provided, by design): a running, SSM-managed, syft-equipped helper Linux instance to attach the scan volume to. vet deliberately does not create/terminate the helper (keeps teardown to a volume + attachment only) — see slice 4. Live validation against a real AMI with verified teardown follows the adapters.
scttfrdmn commentedon Jun 25, 2026
Live validation (2026-06-25) —
vet ami-scanproven end to end; one real bug found + fixedRan the full pipeline against a real AL2023 AMI (
ami-00948338a4aeec604) in account942542972736, with an operator-style helper (throwaway t3.micro: SSM-managed, syft 1.18.1 + awscli, instance-profiles3:PutObjectto a staging bucket). All resources torn down + verified gone (helperterminated, bucket404, IAMNoSuchEntity, zero strayvet:ephemeralvolumes).Bug found by the live test (now fixed)
First run failed at mount:
special device /dev/sdfp1 does not exist. On Nitro instances an EBS volume attached as/dev/sdfsurfaces as an NVMe device (/dev/nvme1n1), so the remote script's name-based device guessing was wrong. Fixed: the remote script now discovers the freshly-attached disk vialsblk(the unmounted disk that isn't the running root) and mounts its largest partition. Re-run log confirms:scanning /dev/nvme1n1p1 (requested /dev/sdf)→ mount → syft → Success.What was proven
snap-0ddddd…) → create volume → attach → SSM mount read-only → syft → upload to S3 → store locally. ✅amzn) that the lossy package list drops — i.e. exactly what the grype source needs (and what a naive OSVLinuxquery is false-clean on).vetmid-run, not a vet defect; I cleaned it up manually.)The fix ships as a follow-up commit to the slice-5 remote script. vet#32 is complete — the AMI deep-content-scan gap (the last open item of the AMI-gating epic, #13) is closed and live-validated.
scttfrdmn commentedon Jun 25, 2026
Complete. All six slices merged (#33–#38) plus the live-validation fix (#39).
vet ami-scanresolves an AMI's backing snapshot → mounts a read-only copy on an operator helper → syfts → stores an SBOM thatvet verify --check-cvesgates on via the distro-aware grype source. Live-validated end to end against a real AL2023 AMI (1549-component SBOM), with volume teardown proven on both success and failure paths. Both CVE sources remain pluggable (--cve-source osv|grype); Amazon Inspector stays a documented alternative source.