2021-10-11 21:06:27 +00:00
< p align = "center" >
< img src = "https://user-images.githubusercontent.com/5199289/136844524-1527b09f-c5cb-4aa9-be54-5aa92a6086c1.png" width = "271" >
< / p >
2020-07-24 00:54:04 +00:00
2021-04-16 12:59:07 +00:00
[![Validations ](https://github.com/anchore/syft/actions/workflows/validations.yaml/badge.svg )](https://github.com/anchore/syft/actions/workflows/validations.yaml)
2020-08-10 20:46:12 +00:00
[![Go Report Card ](https://goreportcard.com/badge/github.com/anchore/syft )](https://goreportcard.com/report/github.com/anchore/syft)
[![GitHub release ](https://img.shields.io/github/release/anchore/syft.svg )](https://github.com/anchore/syft/releases/latest)
2021-04-16 12:35:05 +00:00
[![GitHub go.mod Go version ](https://img.shields.io/github/go-mod/go-version/anchore/syft.svg )](https://github.com/anchore/syft)
2021-10-04 13:29:27 +00:00
[![License: Apache-2.0 ](https://img.shields.io/badge/License-Apache%202.0-blue.svg )](https://github.com/anchore/syft/blob/main/LICENSE)
[![Slack Invite ](https://img.shields.io/badge/Slack-Join-blue?logo=slack )](https://anchore.com/slack)
2020-08-10 20:46:12 +00:00
2021-05-06 16:26:03 +00:00
A CLI tool and go library for generating a Software Bill of Materials (SBOM) from container images and filesystems. Exceptional for vulnerability detection when used with a scanner tool like [Grype ](https://github.com/anchore/grype ).
2020-08-04 19:22:34 +00:00
2021-09-24 15:42:06 +00:00
## We'll be at KubeCon 2021!
Attending KubeCon 2021 in person? Join us for a meetup on **Tuesday, October 12th** .
We’ ll have free swag, giveaways, snacks, and sips. Space will be limited, so make sure to [save your seat ](https://get.anchore.com/2021-kubecon-na-opensource-happy-hour/ )!
---
2020-08-14 17:58:45 +00:00
![syft-demo ](https://user-images.githubusercontent.com/590471/90277200-2a253000-de33-11ea-893f-32c219eea11a.gif )
2020-08-04 19:22:34 +00:00
**Features**
- Catalog container images and filesystems to discover packages and libraries.
- Supports packages and libraries from various ecosystems (APK, DEB, RPM, Ruby Bundles, Python Wheel/Egg/requirements.txt, JavaScript NPM/Yarn, Java JAR/EAR/WAR, Jenkins plugins JPI/HPI, Go modules)
2020-08-12 18:57:22 +00:00
- Linux distribution identification (supports Alpine, BusyBox, CentOS/RedHat, Debian/Ubuntu flavored distributions)
2020-09-25 14:24:24 +00:00
- Supports Docker and OCI image formats
2021-05-06 16:26:03 +00:00
- Direct support for [Grype ](https://github.com/anchore/grype ), a fast and powerful vulnerability matcher.
2020-08-04 19:22:34 +00:00
2020-10-08 19:30:50 +00:00
If you encounter an issue, please [let us know using the issue tracker ](https://github.com/anchore/syft/issues ).
2020-08-11 11:07:55 +00:00
2021-10-04 13:29:27 +00:00
## Installation
### Recommended
```bash
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
```
...or, you can specify a release version and destination directory for the installation:
```
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b < DESTINATION_DIR > < RELEASE_VERSION >
```
### Homebrew
```bash
brew tap anchore/syft
brew install syft
```
**Note**: Currently, Syft is built only for macOS and Linux.
2020-08-04 19:22:34 +00:00
## Getting started
2020-09-25 14:24:24 +00:00
To generate an SBOM for a Docker or OCI image:
2020-08-04 19:22:34 +00:00
```
2021-03-22 19:25:04 +00:00
syft < image >
2020-08-04 19:22:34 +00:00
```
2021-03-23 17:00:25 +00:00
**Note**: This is equivalent to specifying the `packages` subcommand:
```
syft packages < image >
```
2020-08-04 19:22:34 +00:00
The above output includes only software that is visible in the container (i.e., the squashed representation of the image).
To include software from all image layers in the SBOM, regardless of its presence in the final image, provide `--scope all-layers` :
```
2021-03-18 14:58:47 +00:00
syft packages < image > --scope all-layers
2020-08-04 19:22:34 +00:00
```
2021-10-04 13:29:27 +00:00
### Supported sources
2020-08-04 19:22:34 +00:00
Syft can generate a SBOM from a variety of sources:
2021-10-04 13:29:27 +00:00
2020-08-04 19:22:34 +00:00
```
2020-09-25 14:24:24 +00:00
# catalog a container image archive (from the result of `docker image save ...`, `podman save ...`, or `skopeo copy` commands)
2021-03-18 14:58:47 +00:00
syft packages path/to/image.tar
2020-08-04 19:22:34 +00:00
# catalog a directory
2021-03-18 14:58:47 +00:00
syft packages path/to/dir
2020-08-04 19:22:34 +00:00
```
2021-04-13 13:30:57 +00:00
Sources can be explicitly provided with a scheme:
2021-10-04 13:29:27 +00:00
2021-04-13 13:30:57 +00:00
```
docker:yourrepo/yourimage:tag use images from the Docker daemon
docker-archive:path/to/yourimage.tar use a tarball from disk for archives created from "docker save"
oci-archive:path/to/yourimage.tar use a tarball from disk for OCI archives (from Skopeo or otherwise)
oci-dir:path/to/yourimage read directly from a path on disk for OCI layout directories (from Skopeo or otherwise)
dir:path/to/yourproject read directly from a path on disk (any directory)
registry:yourrepo/yourimage:tag pull image directly from a registry (no container runtime required)
```
2021-10-04 13:29:27 +00:00
### Output formats
2020-09-25 14:24:24 +00:00
The output format for Syft is configurable as well:
2021-10-04 13:29:27 +00:00
2020-08-04 19:22:34 +00:00
```
2021-03-18 14:58:47 +00:00
syft packages < image > -o < format >
2020-08-04 19:22:34 +00:00
```
2020-09-25 14:24:24 +00:00
Where the `format` s available are:
- `json` : Use this to get as much information out of Syft as possible!
- `text` : A row-oriented, human-and-machine-friendly output.
2021-07-01 14:52:57 +00:00
- `cyclonedx` : A XML report conforming to the [CycloneDX 1.2 specification ](https://cyclonedx.org/specification/overview/ ).
- `spdx` : A tag-value formatted report conforming to the [SPDX 2.2 specification ](https://spdx.github.io/spdx-spec/ ).
- `spdx-json` : A JSON report conforming to the [SPDX 2.2 JSON Schema ](https://github.com/spdx/spdx-spec/blob/v2.2/schemas/spdx-schema.json ).
2020-09-25 14:24:24 +00:00
- `table` : A columnar summary (default).
2020-08-04 19:22:34 +00:00
## Configuration
Configuration search paths:
- `.syft.yaml`
- `.syft/config.yaml`
- `~/.syft.yaml`
- `<XDG_CONFIG_HOME>/syft/config.yaml`
Configuration options (example values are the default):
```yaml
2020-12-10 03:20:53 +00:00
# the output format of the SBOM report (options: table, text, json)
# same as -o ; SYFT_OUTPUT env var
2020-08-04 19:22:34 +00:00
output: "table"
2020-12-10 03:20:53 +00:00
# suppress all output (except for the SBOM report)
# same as -q ; SYFT_QUIET env var
2020-08-04 19:22:34 +00:00
quiet: false
2021-10-05 19:34:32 +00:00
# same as --file; write output report to a file (default is to write to stdout)
file: ""
2020-12-10 03:20:53 +00:00
# enable/disable checking for application updates on startup
# same as SYFT_CHECK_FOR_APP_UPDATE env var
check-for-app-update: true
2021-03-18 14:58:47 +00:00
# cataloging packages is exposed through the packages and power-user subcommands
2021-03-20 11:33:13 +00:00
package:
cataloger:
2021-03-18 14:58:47 +00:00
# enable/disable cataloging of packages
2021-03-20 11:33:13 +00:00
# SYFT_PACKAGE_CATALOGER_ENABLED env var
enabled: true
2021-05-06 16:26:03 +00:00
2021-03-18 12:53:31 +00:00
# the search space to look for packages (options: all-layers, squashed)
2021-03-20 11:33:13 +00:00
# same as -s ; SYFT_PACKAGE_CATALOGER_SCOPE env var
2021-03-18 12:53:31 +00:00
scope: "squashed"
2021-04-07 20:31:09 +00:00
# cataloging file classifications is exposed through the power-user subcommand
file-classification:
cataloger:
# enable/disable cataloging of file classifications
# SYFT_FILE_CLASSIFICATION_CATALOGER_ENABLED env var
enabled: true
# the search space to look for file classifications (options: all-layers, squashed)
# SYFT_FILE_CLASSIFICATION_CATALOGER_SCOPE env var
scope: "squashed"
2021-04-07 20:28:45 +00:00
# cataloging file contents is exposed through the power-user subcommand
2021-04-09 12:56:01 +00:00
file-contents:
2021-04-07 20:28:45 +00:00
cataloger:
# enable/disable cataloging of secrets
2021-04-09 12:56:01 +00:00
# SYFT_FILE_CONTENTS_CATALOGER_ENABLED env var
2021-04-07 20:28:45 +00:00
enabled: true
# the search space to look for secrets (options: all-layers, squashed)
2021-04-09 12:56:01 +00:00
# SYFT_FILE_CONTENTS_CATALOGER_SCOPE env var
2021-04-07 20:28:45 +00:00
scope: "squashed"
# skip searching a file entirely if it is above the given size (default = 1MB; unit = bytes)
2021-04-09 12:56:01 +00:00
# SYFT_FILE_CONTENTS_SKIP_FILES_ABOVE_SIZE env var
2021-04-07 20:28:45 +00:00
skip-files-above-size: 1048576
# file globs for the cataloger to match on
2021-04-09 12:56:01 +00:00
# SYFT_FILE_CONTENTS_GLOBS env var
2021-04-07 20:28:45 +00:00
globs: []
2021-03-18 14:58:47 +00:00
# cataloging file metadata is exposed through the power-user subcommand
2021-03-18 12:53:31 +00:00
file-metadata:
2021-03-20 11:33:13 +00:00
cataloger:
# enable/disable cataloging of file metadata
# SYFT_FILE_METADATA_CATALOGER_ENABLED env var
enabled: true
2021-05-06 16:26:03 +00:00
2021-03-20 11:33:13 +00:00
# the search space to look for file metadata (options: all-layers, squashed)
# SYFT_FILE_METADATA_CATALOGER_SCOPE env var
scope: "squashed"
2021-05-06 16:26:03 +00:00
2021-03-18 12:53:31 +00:00
# the file digest algorithms to use when cataloging files (options: "sha256", "md5", "sha1")
2021-03-18 14:58:47 +00:00
# SYFT_FILE_METADATA_DIGESTS env var
2021-03-18 12:53:31 +00:00
digests: ["sha256"]
2021-04-01 21:34:15 +00:00
# cataloging secrets is exposed through the power-user subcommand
secrets:
cataloger:
# enable/disable cataloging of secrets
# SYFT_SECRETS_CATALOGER_ENABLED env var
enabled: true
# the search space to look for secrets (options: all-layers, squashed)
# SYFT_SECRETS_CATALOGER_SCOPE env var
scope: "all-layers"
# show extracted secret values in the final JSON report
# SYFT_SECRETS_REVEAL_VALUES env var
reveal-values: false
2021-04-07 20:28:45 +00:00
# skip searching a file entirely if it is above the given size (default = 1MB; unit = bytes)
2021-04-01 21:34:15 +00:00
# SYFT_SECRETS_SKIP_FILES_ABOVE_SIZE env var
2021-04-07 20:28:45 +00:00
skip-files-above-size: 1048576
2021-04-01 21:34:15 +00:00
# name-regex pairs to consider when searching files for secrets. Note: the regex must match single line patterns
# but may also have OPTIONAL multiline capture groups. Regexes with a named capture group of "value" will
2021-05-06 16:26:03 +00:00
# use the entire regex to match, but the secret value will be assumed to be entirely contained within the
2021-04-01 21:34:15 +00:00
# "value" named capture group.
additional-patterns: {}
2021-05-06 16:26:03 +00:00
# names to exclude from the secrets search, valid values are: "aws-access-key", "aws-secret-key", "pem-private-key",
# "docker-config-auth", and "generic-api-key". Note: this does not consider any names introduced in the
2021-04-01 21:34:15 +00:00
# "secrets.additional-patterns" config option.
# SYFT_SECRETS_EXCLUDE_PATTERN_NAMES env var
exclude-pattern-names: []
2021-04-13 13:30:57 +00:00
# options when pulling directly from a registry via the "registry:" scheme
registry:
# skip TLS verification when communicating with the registry
# SYFT_REGISTRY_INSECURE_SKIP_TLS_VERIFY env var
insecure-skip-tls-verify: false
2021-08-17 16:52:51 +00:00
# use http instead of https when connecting to the registry
# SYFT_REGISTRY_INSECURE_USE_HTTP env var
insecure-use-http: false
2021-04-13 13:30:57 +00:00
# credentials for specific registries
auth:
- # the URL to the registry (e.g. "docker.io", "localhost:5000", etc.)
# SYFT_REGISTRY_AUTH_AUTHORITY env var
authority: ""
# SYFT_REGISTRY_AUTH_USERNAME env var
username: ""
# SYFT_REGISTRY_AUTH_PASSWORD env var
password: ""
# note: token and username/password are mutually exclusive
# SYFT_REGISTRY_AUTH_TOKEN env var
token: ""
- ... # note, more credentials can be provided via config file only
2020-08-04 19:22:34 +00:00
log:
# use structured logging
2020-12-10 03:20:53 +00:00
# same as SYFT_LOG_STRUCTURED env var
2020-08-04 19:22:34 +00:00
structured: false
# the log level; note: detailed logging suppress the ETUI
2020-12-10 03:20:53 +00:00
# same as SYFT_LOG_LEVEL env var
2020-08-04 19:22:34 +00:00
level: "error"
# location to write the log file (default is not to have a log file)
2020-12-10 03:20:53 +00:00
# same as SYFT_LOG_FILE env var
2020-08-04 19:22:34 +00:00
file: ""
2021-03-18 14:58:47 +00:00
# uploading package SBOM is exposed through the packages subcommand
2020-12-10 03:20:53 +00:00
anchore:
# (feature-preview) the Anchore Enterprise Host or URL to upload results to (supported on Enterprise 3.0+)
# same as -H ; SYFT_ANCHORE_HOST env var
host: ""
# (feature-preview) the path after the host to the Anchore External API (supported on Enterprise 3.0+)
# same as SYFT_ANCHORE_PATH env var
path: ""
# (feature-preview) the username to authenticate against Anchore Enterprise (supported on Enterprise 3.0+)
# same as -u ; SYFT_ANCHORE_USERNAME env var
username: ""
# (feature-preview) the password to authenticate against Anchore Enterprise (supported on Enterprise 3.0+)
# same as -p ; SYFT_ANCHORE_PASSWORD env var
password: ""
2020-08-11 11:07:55 +00:00
2020-12-10 03:20:53 +00:00
# (feature-preview) path to dockerfile to be uploaded with the syft results to Anchore Enterprise (supported on Enterprise 3.0+)
# same as -d ; SYFT_ANCHORE_DOCKERFILE env var
dockerfile: ""
2020-08-11 11:07:55 +00:00
2021-05-06 16:26:03 +00:00
```