Skip to content

Commit 343ec3b

Browse files
authored
feat: add rust support (#878)
* feat: add rust support * fix: rename cargo provider, resolve package renames, add exhortignore docs
1 parent 09c612c commit 343ec3b

File tree

12 files changed

+2723
-195
lines changed

12 files changed

+2723
-195
lines changed

README.md

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The Red Hat Dependency Analytics extension uses vulnerability data sources for t
1515
- Golang
1616
- Python
1717
- Gradle (Kotlin / Groovy DSL)
18+
- Rust (Cargo)
1819

1920
<br >**NOTE:**
2021
The Red Hat Dependency Analytics extension is an online service hosted and maintained by Red Hat.
@@ -55,6 +56,7 @@ When a specific path is configured in the settings, it takes precedence over the
5556
| Golang | `go` | `go.mod` |
5657
| Python | `python3/pip3` or `python/pip` | `requirements.txt` |
5758
| Gradle | `gradle` | `build.gradle` |
59+
| Rust | `cargo` | `Cargo.toml` |
5860

5961
**Note:** For NPM, PNPM, and Yarn projects, you can use [fnm](https://github.com/Schniz/fnm) or [nvm](https://github.com/nvm-sh/nvm) for Node.js version management. The extension will automatically detect and use the binary path from the `FNM_DIR` or `NVM_DIR` environment variables.
6062

@@ -117,6 +119,9 @@ You can set the vulnerability severity alert level to `Error` or `Warning` for i
117119
#### Golang:
118120
* `useGoMVS` : Use the minimal version selection algorithm to select a set of module versions to use when building Go packages.
119121

122+
#### Rust (Cargo):
123+
* `cargo.executable.path` : Specify the absolute path to the `cargo` executable. If not set, the extension uses `cargo` from your system `PATH`.
124+
120125
#### HTTP Proxy:
121126
* `httpProxy` : Configure HTTP proxy settings for the extension. There are three options available:
122127
- `on`: Always use the HTTP proxy regardless of VS Code's proxy settings
@@ -156,7 +161,7 @@ Specify glob patterns for manifests to be ignored for background analysis e.g. `
156161
## Features
157162

158163
- **Component analysis**
159-
<br >Upon opening a manifest file, such as a `pom.xml`, `package.json`, `go.mod` or `requirements.txt` file, a vulnerability scan starts the analysis process.
164+
<br >Upon opening a manifest file, such as a `pom.xml`, `package.json`, `go.mod`, `requirements.txt`, or `Cargo.toml` file, a vulnerability scan starts the analysis process.
160165
The scan provides immediate inline feedback on detected security vulnerabilities for your application's, and container's dependencies.
161166
Such dependencies are appropriately underlined in red, and hovering over it gives you a short summary of the security concern from the available data sources.
162167
The summary has the full package name, version number, the amount of known security vulnerabilities, and the highest severity status of said vulnerabilities.
@@ -178,7 +183,7 @@ Specify glob patterns for manifests to be ignored for background analysis e.g. `
178183
- **License compatibility checking**
179184
<br >Red Hat Dependency Analytics automatically checks for license compatibility issues in your project:
180185

181-
- **License mismatch detection**: For projects with license fields in their manifest files (`package.json`, `pom.xml`, `build.gradle`), the extension detects mismatches between the license declared in the manifest and the LICENSE file. A red underline appears on the license field with a quick fix to update the manifest with the LICENSE file's value.
186+
- **License mismatch detection**: For projects with license fields in their manifest files (`package.json`, `pom.xml`, `build.gradle`, `Cargo.toml`), the extension detects mismatches between the license declared in the manifest and the LICENSE file. A red underline appears on the license field with a quick fix to update the manifest with the LICENSE file's value.
182187

183188
- **Incompatible dependency licenses**: The extension identifies dependencies whose licenses are more restrictive than your project's license. A notification displays the count of incompatible dependencies, helping you maintain license compliance.
184189

@@ -287,6 +292,24 @@ Specify glob patterns for manifests to be ignored for background analysis e.g. `
287292
}
288293
```
289294

295+
- **Rust (Cargo)**
296+
<br >If you want to ignore vulnerabilities for a dependency in a `Cargo.toml` file, you must add `# exhortignore` to the end of the line as a comment against the dependency in the manifest file.
297+
For inline dependencies:
298+
299+
```toml
300+
[dependencies]
301+
serde = "1.0" # exhortignore
302+
tokio = { version = "1.0", features = ["full"] } # exhortignore
303+
```
304+
305+
For table-style dependencies, add the comment on the section header:
306+
307+
```toml
308+
[dependencies.reqwest] # exhortignore
309+
version = "0.11"
310+
features = ["json"]
311+
```
312+
290313
- **Excluding developmental or test dependencies**
291314
<br >Red Hat Dependency Analytics does not analyze dependencies marked as `dev` or `test`, these dependencies are ignored.
292315

@@ -346,6 +369,26 @@ Specify glob patterns for manifests to be ignored for background analysis e.g. `
346369
```
347370

348371
For example, creating an alternative file to `requirements.txt`, like `requirements-dev.txt` or `requirements-test.txt` and adding the dev or test dependencies there instead.
372+
373+
For example, placing dependencies under `[dev-dependencies]` or `[build-dependencies]` in a `Cargo.toml` file. Red Hat Dependency Analytics excludes these from analysis and only reports on `[dependencies]`, `[workspace.dependencies]`, and platform-specific sections such as `[target.'cfg(windows)'.dependencies]`.
374+
375+
```toml
376+
[package]
377+
name = "my-crate"
378+
version = "0.1.0"
379+
380+
[dependencies]
381+
serde = "1.0"
382+
383+
[dev-dependencies]
384+
# Excluded from analysis
385+
mockall = "0.11"
386+
387+
[build-dependencies]
388+
# Excluded from analysis
389+
cc = "1.0"
390+
```
391+
349392

350393
- **Red Hat Dependency Analytics report**
351394
<br >The Red Hat Dependency Analytics report is a temporary HTML file that exist if the **Red Hat Dependency Analytics Report** tab remains open.

0 commit comments

Comments
 (0)