Scan Binaries

Scanning Files on the Local File System

Use the jf scan command to scan files on your local file system with JFrog Xray.

Command: scan, s

Commands Parameters

ParameterOptional/DefaultDescription
--server-idOptionalServer ID configured using jf c add. Defaults to the configured server if not specified.
--urlOptionalSpecifies the URL of the JFrog platform.
--userOptionalSpecifies the user name of your JFrog platform.
--passwordOptionalSpecifies the user password of your JFrog platform.
--access-tokenOptionalSpecifies the access token of your JFrog platform.
--xray-urlOptionalSpecifies the URL of your Xray server.
--specOptionalPath to a file specifying files to scan. Cannot be used with the pattern argument.
--projectOptionalJFrog project key for security violations. Mutually exclusive with --repo-path and --watches.
--repo-pathOptionalArtifactory repository path for determining violations. Mutually exclusive with --project and --watches.
--insecure-tlsDefault: falseSet to true to skip TLS certificates verification.
--watchesOptionalComma-separated list of Xray watches. Supported violations are CVEs, Operational Risks, and Licenses. Mutually exclusive with --project and --repo-path.
--licensesDefault: falseDisplay license information.
--vulnOptionalDisplay all vulnerabilities, regardless of Xray policy settings.
--failDefault: trueWhen one of --watches, --project, or --repo-path is used and a 'Fail build' rule is matched, returns exit code 3. Set to false to see violations with exit code 0.
--scaDefault: falseSelective scanners mode: run the SCA sub-scan. --sca alone also runs Contextual Analysis; combine with --without-contextual-analysis to run SCA only. Can be combined with --secrets.
--without-contextual-analysisDefault: falseDisable Contextual Analysis after --sca. Relevant only with --sca.
--secretsDefault: falseSelective scanners mode: run the Secrets sub-scan. Can be combined with --sca.
--validate-secretsDefault: falseTrigger token validation on found secrets. Relevant only with --secrets.
--min-severityOptionalMinimum severity of issues to display: Low, Medium, High, Critical, or Scanned - No Issues.
--fixable-onlyDefault: falseDisplay only issues that have a fix version.
--formatDefault: tableOutputs scan results in table, json, simple-json, sarif, and cyclonedx format.
--sbomDefault: falseDisplays the Software Bill of Materials (SBOM) for the project when set to true. Only applicable if the --sca flag is also used and the output format is table or cyclonedx.
--extended-tableDefault: falseInclude extended fields such as CVSS and Xray Issue Id in the table. Ignored unless --format is table.
--bypass-archive-limitsDefault: falseBypass the indexer-app archive size limits. Required for archives that exceed Xray's default size limit.
--threadsDefault: 3Number of parallel threads used to scan.
--recursiveDefault: trueSet to false to skip collecting artifacts in sub-folders.
--antDefault: falseUse an Ant pattern instead of wildcards to collect files to scan.
--regexpDefault: falseUse a regular expression instead of wildcards to collect files to scan.

Arguments

ArgumentDescription
PatternSpecifies the file system path to artifacts. Supports wildcards.

Examples

Scan with a specific watch: Scans all files at path/to/files/ using the watch1 defined in Xray.

jf s "path/to/files/" --watches "watch1"

Scan with multiple watches: Scans files using watch1 and watch2 defined in Xray.

jf s "path/to/files/" --watches "watch1,watch2"

Scan specific file types: Scans .zip files using watch1 and watch2.

jf s "path/to/files/*.zip" --watches "watch1,watch2"

Scan with project policies: Scans .tgz files using policies defined for project-1.

jf s "path/to/files/*.tgz" --project "project-1"

Scan with repository path: Scans .tgz files using policies for libs-local/release-artifacts/.

jf s "*.tgz" --repo-path "libs-local/release-artifacts/"

Scan without specific policies: Shows all known vulnerabilities for .tgz files.

jf s "*.tgz"

Scanning Docker Containers on the Local File System

Use jf docker scan to scan Docker containers locally using the Docker client and JFrog Xray.

Commands Parameters

ParameterOptional/DefaultDescription
--server-idOptionalConfigured server ID.
--urlOptionalSpecifies the URL of the JFrog platform.
--userOptionalSpecifies the user name of your JFrog platform.
--passwordOptionalSpecifies the user password of your JFrog platform.
--access-tokenOptionalSpecifies the access token of your JFrog platform.
--xray-urlOptionalSpecifies the URL of your Xray server.
--projectOptionalJFrog project key for security violations.
--repo-pathOptionalArtifactory repository path for determining violations.
--insecure-tlsDefault: falseSet to true to skip TLS certificates verification.
--watchesOptionalComma-separated list of Xray watches.
--licensesDefault: falseDisplay license information.
--vulnOptionalShow all vulnerabilities.
--failDefault: trueWhen a Fail Build rule is matched via --watches, --project, or --repo-path, returns exit code 3. Set to false to see violations with exit code 0.
--scaDefault: falseSelective scanners mode: run the SCA sub-scan. Combine with --without-contextual-analysis to run SCA only.
--without-contextual-analysisDefault: falseDisable Contextual Analysis after --sca.
--secretsDefault: falseSelective scanners mode: run the Secrets sub-scan.
--validate-secretsDefault: falseValidate detected secrets. Relevant only with --secrets.
--min-severityOptionalMinimum severity of issues to display: Low, Medium, High, Critical, or Scanned - No Issues.
--fixable-onlyDefault: falseDisplay only issues that have a fix version.
--formatDefault: tableOutputs scan results in table, json, simple-json, sarif, and cyclonedx format.
--sbomDefault: falseDisplays the Software Bill of Materials (SBOM) for the project when set to true. Only applicable if the --sca flag is also used and the output format is table or cyclonedx.
--extended-tableDefault: falseInclude extended fields such as CVSS and Xray Issue Id. Ignored unless --format is table.
--bypass-archive-limitsDefault: falseBypass the indexer-app archive size limits. May be required for large layers.

Arguments

ArgumentDescription
Image TagThe Docker image tag to scan.

Examples

Scan all vulnerabilities: Scans img1:1.0.0 and displays all known vulnerabilities.

jf docker scan reg1/repo1/img1:1.0.0

Scan with project policies: Displays violations for my-project.

jf docker scan reg1/repo1/img1:1.0.0 --project my-project

Scan with Xray watch: Shows violations based on my-watch.

jf docker scan reg1/repo1/img1:1.0.0 --watches my-watch

Scan with repository path: Displays violations for releases-local/app1/.

jf docker scan reg1/repo1/img1:1.0.0 --repo-path releases-local/app1/

Scanning Image Tarballs on the Local File System

Use the scan command to scan tarballs of Docker and OCI images saved on the local file system.

It requires saving the image as a tar file using a compliant tool and then scanning it with the jf s command.

Examples

Using Docker

Save and scan an image:

docker save --output my-image-docker.tar my-image:1.0.0
jf s my-image-docker.tar

Using Skopeo

Scan Docker format:

skopeo copy docker-daemon:my-image:1.0.0 docker-archive:my-image-docker.tar
jf s my-image-docker.tar

Scan OCI format:

skopeo copy docker-daemon:my-image:1.0.0 oci-archive:my-image-oci.tar
jf s my-image-oci.tar

Using Podman

Scan Docker format:

podman save --format=docker-archive -o my-image-docker.tar my-image:1.0.0
jf s my-image-docker.tar

Scan OCI format:

podman save --format=oci -o my-image-oci.tar my-image:1.0.0
jf s my-image-oci.tar

Using Kaniko

Build and scan an image:

docker run -it --rm -v $(pwd):/workspace gcr.io/kaniko-project/executor:v1.8.1-debug -f Dockerfile --no-push --tarPath my-image.tar -d my-image:1.0 -c . --cleanup
jf s my-image.tar

Did this page help you?