Skip to content

Commit f8eec77

Browse files
authored
Update readme usage section (#171)
These are some small changes to the usage section of the README, based on conversations with @olivekl. The goal was to clarify the different options available to the user.
1 parent bd903d5 commit f8eec77

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

README.md

+15-24
Original file line numberDiff line numberDiff line change
@@ -83,46 +83,43 @@ All releases on the same Major version will be guaranteed to have backward compa
8383

8484
## Usage
8585

86-
OSV-Scanner collects a list of dependencies and versions that are used in your project, before matching this list against the OSV database via the [OSV.dev API](https://osv.dev#use-the-api). To build the list of dependencies, you can point OSV-Scanner at your project directory, or manually pass in the path to individual manifest files.
86+
OSV-Scanner parses lockfiles, SBOMs, and git directories to determine your project's open source dependencies. These dependencies are matched against the OSV database via the [OSV.dev API](https://osv.dev#use-the-api) and known vulnerabilities are returned to you in the output.
8787

88-
### Scan a directory
88+
### General use case: scanning a directory
8989

90-
Walks through a list of directories to find:
90+
```console
91+
osv-scanner -r /path/to/your/dir
92+
```
9193

92-
- Lockfiles
93-
- SBOMs
94-
- git directories for the latest commit hash
94+
The preceding command will find lockfiles, SBOMs, and git directories in your target directory and use them to determine the dependencies to check against the OSV database for any known vulnerabilities.
9595

96-
which is used to build the list of dependencies to be matched against OSV vulnerabilities.
96+
The recursive flag `-r` or `--recursive` will tell the scanner to search all subdirectories in addition to the specified directory. It can find additional lockfiles, dependencies, and vulnerabilities. If your project has deeply nested subdirectories, a recursive search may take a long time.
9797

98-
Can be configured to recursively walk through subdirectories with the `--recursive` / `-r` flag.
98+
Git directories are searched for the latest commit hash. Searching for git commit hash is intended to work with projects that use git submodules or a similar mechanism where dependencies are checked out as real git repositories.
9999

100-
Searching for git commit hash is intended to work with projects that use
101-
git submodules or a similar mechanism where dependencies are checked out
102-
as real git repositories.
100+
### Specify SBOM
103101

104-
#### Example
102+
If you want to check for known vulnerabilities only in dependencies in your SBOM, you can use the following command:
105103

106104
```console
107-
osv-scanner -r /path/to/your/dir
105+
osv-scanner --sbom=/path/to/your/sbom.json
108106
```
109107

110-
### Input an SBOM
111-
112108
[SPDX] and [CycloneDX] SBOMs using [Package URLs] are supported. The format is
113109
auto-detected based on the input file contents.
114110

115111
[SPDX]: https://spdx.dev/
116112
[CycloneDX]: https://cyclonedx.org/
117113
[Package URLs]: https://github.com/package-url/purl-spec
118114

119-
#### Example
115+
### Specify Lockfile(s)
116+
If you want to check for known vulnerabilities in specific lockfiles, you can use the following command:
120117

121118
```console
122-
osv-scanner --sbom=/path/to/your/sbom.json
119+
osv-scanner --lockfile=/path/to/your/package-lock.json --lockfile=/path/to/another/Cargo.lock
123120
```
124121

125-
### Input a lockfile
122+
It is possible to specify more than one lockfile at a time.
126123

127124
A wide range of lockfiles are supported by utilizing this [lockfile package](https://github.com/google/osv-scanner/tree/main/pkg/lockfile). This is the current list of supported lockfiles:
128125

@@ -145,12 +142,6 @@ A wide range of lockfiles are supported by utilizing this [lockfile package](htt
145142
- `yarn.lock`
146143
- `/lib/apk/db/installed` (Alpine)
147144

148-
#### Example
149-
150-
```console
151-
$ osv-scanner --lockfile=/path/to/your/package-lock.json --lockfile=/path/to/another/Cargo.lock
152-
```
153-
154145
### Scanning a Debian based docker image packages (preview)
155146

156147
This tool will scrape the list of installed packages in a Debian image and query for vulnerabilities on them.

0 commit comments

Comments
 (0)