mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-13 00:00:19 -08:00
feat(dart): use first version of constraint for dependencies using SDK version (#6239)
Signed-off-by: knqyf263 <knqyf263@gmail.com> Co-authored-by: knqyf263 <knqyf263@gmail.com>
This commit is contained in:
@@ -4,9 +4,9 @@ Trivy supports [Dart][dart].
|
||||
|
||||
The following scanners are supported.
|
||||
|
||||
| Package manager | SBOM | Vulnerability | License |
|
||||
|-------------------------| :---: | :-----------: |:-------:|
|
||||
| [Dart][dart-repository] | ✓ | ✓ | - |
|
||||
| Package manager | SBOM | Vulnerability | License |
|
||||
|-------------------------|:----:|:-------------:|:-------:|
|
||||
| [Dart][dart-repository] | ✓ | ✓ | - |
|
||||
|
||||
The following table provides an outline of the features Trivy offers.
|
||||
|
||||
@@ -21,6 +21,24 @@ In order to detect dependencies, Trivy searches for `pubspec.lock`.
|
||||
Trivy marks indirect dependencies, but `pubspec.lock` file doesn't have options to separate root and dev transitive dependencies.
|
||||
So Trivy includes all dependencies in report.
|
||||
|
||||
### SDK dependencies
|
||||
Dart uses version `0.0.0` for SDK dependencies (e.g. Flutter). It is not possible to accurately determine the versions of these dependencies.
|
||||
|
||||
Therefore, we use the first version of the constraint for the SDK.
|
||||
|
||||
For example in this case the version of `flutter` should be `3.3.0`:
|
||||
```yaml
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
sdks:
|
||||
dart: ">=2.18.0 <3.0.0"
|
||||
flutter: "^3.3.0"
|
||||
```
|
||||
|
||||
### Dependency tree
|
||||
To build `dependency tree` Trivy parses [cache directory][cache-directory]. Currently supported default directories and `PUB_CACHE` environment (absolute path only).
|
||||
!!! note
|
||||
Make sure the cache directory contains all the dependencies installed in your application. To download missing dependencies, use `dart pub get` command.
|
||||
|
||||
Reference in New Issue
Block a user