Skip to content

feat: vet ami-scan — deep AMI content scanning, end to end — vet#32 slice 6 - #38

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/ami-scan-cli
Jun 25, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/ami-scan-cli

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Sixth slice of vet#32 — the CLI that ties the pipeline together. Closes the AMI deep-content-scan gap end to end (the last open item of the AMI-gating epic, #13). Code half here; live validation follows in the same effort.

What

vet ami-scan <ami-id> --helper-instance i-… --az us-east-1a --scan-bucket my-staging
vet verify   <ami-id> --check-cves high     # gates on the scanned SBOM (auto-routes to grype)

ami-scan runs amiscan.NewLive: resolve the AMI's backing snapshot → create+attach a volume → SSM-mount read-only + syft → download the CycloneDX SBOM → store it at the AMI's SBOM path, where the existing verify --check-cves (slice 2: AMIs auto-route to the distro-aware grype source) reads it.

  • Teardown is guaranteed — the volume release is deferred, so it runs even if storing the SBOM fails; a teardown error is surfaced as a warning, not swallowed.
  • Bounded blast radius (slices 4–5): vet creates a volume + attachment only — never the helper instance, never the AMI's own snapshot.
  • Validation guards run before any AWS call: non-AMI ref, and missing --helper-instance/--az/--scan-bucket.

Tests

  • cmd/vet/ami_scan_test.go: the validation matrix + a help-documents-the-prereqs check.
  • Full suite green; the pipeline's bug-prone internals are fake-tested across slices 3–5.

Docs

README's stale "deep AMI-content scanning … not yet generated by vet" note becomes the real vet ami-scan section. CHANGELOG updated.

Live validation (next, this same effort)

Against a real AL2023 AMI: stand up a throwaway SSM+syft helper + an S3 staging bucket, run ami-scan, confirm the SBOM + a grype-scanned verify, then tear everything down with verification (helper, bucket, and confirm vet's own scan volume was released). Results posted to vet#32.

Note: gofmt flags internal/sign/sign.go on the current toolchain — pre-existing drift, untouched here.

…ice 6

The CLI that ties the amiscan pipeline together.

  vet ami-scan <ami-id> --helper-instance i-… --az … --scan-bucket …

resolves the AMI's backing snapshot, mounts a copy read-only on the operator's
helper instance, syfts the filesystem, and stores the SBOM at the AMI's
CycloneDX store path — where `vet verify <ami-id> --check-cves <level>` reads it
(AMIs auto-route to the distro-aware grype scanner from slice 2).

vet creates a volume + attachment and tears them down when done (deferred
release, even on error) — never the helper instance, never the AMI's own
snapshot. Validation guards (non-AMI ref, missing helper/az/bucket) run before
any AWS call.

Updates README (the stale "not yet generated by vet" note becomes the ami-scan
section) and CHANGELOG. Live validation against a real AMI follows.

Tests: cmd/vet/ami_scan_test.go — arg/flag validation matrix + help-documents-
prereqs. Full suite green.
@scttfrdmn
scttfrdmn merged commit a51e9de into main Jun 25, 2026
2 checks passed
@scttfrdmn
scttfrdmn deleted the feat/ami-scan-cli branch June 25, 2026 22:53
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