feat: add scan sbom command for SBOM-to-VEX generation (PPSC-971) - #269
Merged
Conversation
Add `armis-cli scan sbom <path>` which uploads a pre-existing SBOM artifact (artifact_type=sbom, vex_generate=true) and downloads the OpenVEX document the backend generates from it. - internal/scan/sbom/sbom.go: scan driver mirroring the repo scanner. Accepts a single SBOM file (.json/.xml), a directory of SBOMs, or a pre-built .tar/.tar.gz/.tgz. Packs file/dir inputs into a tar.gz (symlinks skipped) and uploads from disk so Content-Length is set for S3. Runs StartIngest -> WaitForIngest -> SBOMVEXDownloader.Download, then prints a "VEX generated ->" line with statement count. - internal/cmd/scan_sbom.go: cobra command registered under scan. --vex is implied; warns on --sbom/--sbom-output. Honors --vex-output. - No-findings UX: returns an empty completed ScanResult so --fail-on/summary/findings-table degrade gracefully. - internal/testutil/mockapi.go: mock /ingest/results + fake VEX download endpoint gated on new VEXContent config field. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Test Coverage Reporttotal: (statements) 73.1% Coverage by function |
yiftach-armis
approved these changes
Jul 9, 2026
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
armis-cli scan sbom <path>— uploads a pre-existing SBOM artifact (artifact_type=sbom,vex_generate=true) and downloads the OpenVEX v0.2.0 document the backend generates from it.Backend side: Moose branch
feat/PPSC-971-generate-vex-api(PR #2402) adds thesbomartifact type and theGrypeVexGenerator. No API request-shape changes — only a newartifact_typeenum value.What's included
internal/scan/sbom/sbom.go— scan driver mirroring the repo scanner.<path>may be a single SBOM file (.json/.xml), a directory of SBOMs, or a pre-built.tar/.tar.gz/.tgz. File/dir inputs are packed into atar.gz(symlinks skipped) and uploaded from disk soContent-Lengthis set for S3. RunsStartIngest → WaitForIngest → SBOMVEXDownloader.Download, then printsVEX generated → <path> (N statements).internal/cmd/scan_sbom.go— cobra command registered underscan.--vexis implied (alwaysGenerateVEX: true); warns on--sbom/--sbom-output(can't generate an SBOM from an SBOM), matchingscan.go's warning style. Honors--vex-output(default.armis/<artifact>-vex.json).ScanResult;--fail-on/summary/findings-table all degrade gracefully and the success line points at the written VEX file.internal/testutil/mockapi.go— mock/api/v1/ingest/results+ fake presigned VEX download endpoint, gated on a newVEXContentconfig field.Testing
go build ./...,go vet ./...cleango test ./...passes, including new tests: single file, directory, non-existent path, artifact-name derivation, VEX statement counting, and end-to-end command flow.make lint(golangci-lint) not run locally — not installed on this machine; relying on CI.🤖 Generated with Claude Code