Skip to content

Commit

Permalink
Create SBOMs for images pulled during package creation (#367)
Browse files Browse the repository at this point in the history
* Create SBOMs for images while creating packages
* docs: add adr for sbom capability
* Use existing multi-image tars when generating SBOMs during package create
* docs: add basic sbom docs
* add sbom html viewer generator
* Use gotemplate for sbom viewer and make each html file standalone/portable
* Add deploy prompt for SBOM

Co-authored-by: Jeff McCoy <[email protected]>
  • Loading branch information
mikhailswift and jeff-mccoy authored Apr 26, 2022
1 parent 0463f0d commit 3c6afd5
Show file tree
Hide file tree
Showing 16 changed files with 1,045 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ terraform.tfstate.backup
.zarf*
zarf-pki
.scratch/
zarf-sbom/
19 changes: 19 additions & 0 deletions docs/adr/0004-generate-sboms-with-witness.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 4. SBOM Generation with Witness

Date: 2022-03-29

## Status

Accepted

## Context

SBOM are required for software running on government hardware per EO14028.

## Decision

Using Witness' Syft attestor functionality allows Zarf to continue to get more refined SBOM capabilities as Witness' capabilities expand over time. Syft is capable of finding installed packages and some binaries for statically compiled dependencies over each image within a Zarf package. This allows for SBOMs for each image to be generated and packaged along with the Zarf package. Abilities to export the SBOM to SDPX and CycloneDX formatted documents as well as a browsable web page are in works.

## Consequences

Added depenencies of Witness and Syft which may inflate Zarf binary size. Increased Zarf package size -- Jeff noted that uncompressed SBOMs for Big Bang Core came in at around 200MB.
14 changes: 14 additions & 0 deletions docs/sbom.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SBOMs in Zarf

A Zarf generates a Software Bill of Material (SBOM) for each of the images within a Zarf package. This allows consumers of Zarf packages to get in depth knowledge of what is contained within the Zarf package.

## What are SBOMs?

SBOMs are a collection of dependencies, tools, and other information about how a piece of software was built. Zarf collects information about the images within a Zarf package such as the base distro, packages installed, licenses of installed software, and more.

This allows users of the software to have a clearer understanding of what is running and find potential vulnerabilities that may otherwise go undetected.


## How does Zarf generate SBOMs?

Zarf uses [Syft](https://github.com/anchore/syft/) to generate SBOMs for each image during `zarf package create`
28 changes: 25 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ require (
github.com/sigstore/cosign v1.7.1
github.com/spf13/cobra v1.4.0
github.com/stretchr/testify v1.7.1
github.com/testifysec/witness v0.1.7
golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29
helm.sh/helm/v3 v3.8.1
k8s.io/api v0.23.5
Expand Down Expand Up @@ -74,6 +75,7 @@ require (
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/BurntSushi/toml v0.4.1 // indirect
github.com/CycloneDX/cyclonedx-go v0.4.0 // indirect
github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
Expand All @@ -89,10 +91,16 @@ require (
github.com/ReneKroon/ttlcache/v2 v2.11.0 // indirect
github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d // indirect
github.com/ThalesIgnite/crypto11 v1.2.5 // indirect
github.com/acobaugh/osrelease v0.1.0 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/adrg/xdg v0.4.0 // indirect
github.com/alessio/shellescape v1.4.1 // indirect
github.com/andybalholm/brotli v1.0.1 // indirect
github.com/anchore/go-rpmdb v0.0.0-20210914181456-a9c52348da63 // indirect
github.com/anchore/go-version v1.2.2-0.20200701162849-18adb9c92b9b // indirect
github.com/anchore/packageurl-go v0.0.0-20210922164639-b3fa992ebd29 // indirect
github.com/anchore/stereoscope v0.0.0-20220307154759-8a5a70c227d3 // indirect
github.com/anchore/syft v0.41.0 // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/armon/go-metrics v0.3.10 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
Expand All @@ -115,6 +123,7 @@ require (
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20220228164355-396b2034c795 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/bmatcuk/doublestar/v4 v4.0.2 // indirect
github.com/bshuster-repo/logrus-logstash-hook v1.0.0 // indirect
github.com/bugsnag/bugsnag-go v1.0.5-0.20150529004307-13fd6b8acda0 // indirect
github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b // indirect
Expand Down Expand Up @@ -145,14 +154,17 @@ require (
github.com/docker/go-units v0.4.0 // indirect
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
github.com/facebookincubator/nvdtools v0.1.4 // indirect
github.com/fatih/camelcase v1.0.0 // indirect
github.com/felixge/httpsnoop v1.0.1 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/fvbommel/sortorder v1.0.2 // indirect
github.com/gabriel-vasile/mimetype v1.4.0 // indirect
github.com/gdamore/encoding v1.0.0 // indirect
github.com/gdamore/tcell/v2 v2.4.0 // indirect
github.com/go-chi/chi v4.1.2+incompatible // indirect
Expand All @@ -172,6 +184,7 @@ require (
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.10.0 // indirect
github.com/go-restruct/restruct v1.2.0-alpha // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/go-test/deep v1.0.8 // indirect
github.com/gobwas/glob v0.2.3 // indirect
Expand Down Expand Up @@ -212,7 +225,7 @@ require (
github.com/hashicorp/go-uuid v1.0.2 // indirect
github.com/hashicorp/go-version v1.4.0 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/hcl v1.0.1-0.20190430135223-99e2f22d1c94 // indirect
github.com/hashicorp/vault/api v1.5.0 // indirect
github.com/hashicorp/vault/sdk v0.4.1 // indirect
github.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87 // indirect
Expand All @@ -223,6 +236,7 @@ require (
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jedisct1/go-minisign v0.0.0-20210703085342-c1f07ee84431 // indirect
github.com/jinzhu/copier v0.3.2 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jmoiron/sqlx v1.3.4 // indirect
github.com/josharian/intern v1.0.0 // indirect
Expand All @@ -243,12 +257,13 @@ require (
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/miekg/pkcs11 v1.1.1 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/moby/locker v1.0.1 // indirect
Expand All @@ -263,6 +278,7 @@ require (
github.com/nwaples/rardecode v1.1.0 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.3-0.20220114050600-8b9d41f48198 // indirect
github.com/opencontainers/runc v1.1.1 // indirect
Expand All @@ -284,6 +300,7 @@ require (
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/sahilm/fuzzy v0.1.0 // indirect
github.com/sassoftware/relic v0.0.0-20210427151427-dfb082b79b74 // indirect
github.com/scylladb/go-set v1.0.2 // indirect
github.com/secure-systems-lab/go-securesystemslib v0.3.1 // indirect
github.com/segmentio/ksuid v1.0.4 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
Expand All @@ -294,6 +311,7 @@ require (
github.com/sigstore/sigstore v1.2.1-0.20220401110139-0e610e39782f // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 // indirect
github.com/spdx/tools-golang v0.2.0 // indirect
github.com/spf13/afero v1.8.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
Expand All @@ -308,6 +326,9 @@ require (
github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399 // indirect
github.com/ulikunitz/xz v0.5.10 // indirect
github.com/vbatts/tar-split v0.11.2 // indirect
github.com/vifraa/gopom v0.1.0 // indirect
github.com/wagoodman/go-partybus v0.0.0-20210627031916-db1f5573bbc5 // indirect
github.com/wagoodman/go-progress v0.0.0-20200731105512-1020f39e6240 // indirect
github.com/xanzy/go-gitlab v0.61.0 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
Expand All @@ -327,6 +348,7 @@ require (
go.uber.org/zap v1.21.0 // indirect
go4.org/intern v0.0.0-20211027215823-ae77deb06f29 // indirect
go4.org/unsafe/assume-no-moving-gc v0.0.0-20211027215541-db492cf91b37 // indirect
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect
golang.org/x/net v0.0.0-20220325170049-de3da57026de // indirect
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
Expand Down
Loading

0 comments on commit 3c6afd5

Please sign in to comment.