Vault Radar
scan file
The scan file command is used for scanning a file.
It is similar to scan folder command but can
scan a single file. One difference though is that it can read data from standard input.
Usage
Usage: vault-radar scan file [options]
Command options
--path, -p: If specified scans the given folder, otherwise it scans current working dir--name, -n: Specifies the file name to be used in output, defaults to real filename--outfile, -o: Specifies the file to store information about found secrets (required)--format, -f: Specifies the output format, csv and json are supported. Defaults to csv--baseline, -b: Specifies the file with previous scan results. Only new secrets will be reported.--limit, -l: Specifies the maximum number of secrets to be reported. The scan will stop when the limit is reached--host-name: Specifies the host name to use in risk URI, defaults to local hostname--index-file: Specifies the index file path to use in order to determine which risks are Vaulted--disable-ui: Specifies that the scan summary should not be logged to stdout--skip-activeness: If specified, skips activeness checks--offline: Runs without connecting to HCP. Requires a valid license
Scan a file and write the results to a file in CSV format, this is the default format for output.
$ vault-radar scan file -p <PATH TO FILE> -o <PATH TO OUTPUT>.csv
Scanning a file and output in JSON
Scan a file and write the results to a file in JSON Lines format.
$ vault-radar scan file -p <PATH TO FILE> -o <PATH TO OUTPUT>.jsonl -f json
Read data from stdin
Scan data coming from stdin.
The --name parameter can be used to name data coming from stdin, and it will be used
in secret URI in the output file.
$ echo "password abcABC123" | vault-radar scan file \
-o <PATH TO OUTPUT>.csv \
--name <NAME>
Scanning using a baseline file
Perform a scan using a previous scan’s result and write the new changes to an outfile.
With -b option, only new risks, risks that were not found in the previous scan will be
reported.
$ vault-radar scan file -p <PATH TO FILE> \
-b <PATH TO BASELINE>.csv \
-o <PATH TO OUTPUT>.csv
HCP-connected and offline scans
When you run scan file without --offline, the CLI connects to HCP to use the
shared secret-hashing salt and upload scan results. To run without an HCP connection,
provide a valid license and an output file, then pass --offline. Refer to Use Vault
Radar CLI in offline mode for license setup and
offline scan requirements. For HCP-connected scans, refer to Upload results to
HCP.
Scanning using a Vault index file
Perform a scan using a generated vault index and write the results to an outfile. In this mode, if a risk was previously found in Vault, the scan results will report the location in Vault as well.
$ vault-radar scan file -p <PATH TO FILE> -o <PATH TO OUTPUT>.csv \
--index-file <PATH TO VAULT INDEX>.jsonl
Scan and restrict the number of secrets found
Scan a clone and write the results to an outfile and stop scanning when the defined number of secrets are found.
$ vault-radar scan file -p <PATH TO FILE> \
-o <PATH TO OUTPUT>.csv \
-l <NUM OF SECRETS>