Skip to content

Commit

Permalink
fix(license): add FilePath to results to allow for path filtering via…
Browse files Browse the repository at this point in the history
… ignorefile
  • Loading branch information
dus7eh committed Feb 28, 2024
1 parent e1ea02c commit 88a6154
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/docs/configuration/filtering.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ Available fields:
| Field | Required | Type | Description |
|------------|:--------:|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| id || string | The identifier of the vulnerability, misconfiguration, secret, or license[^1]. |
| paths[^2] | | string array | The list of file paths to ignore. If `paths` is not set, the ignore finding is applied to all files. |
| paths | | string array | The list of file paths to ignore. If `paths` is not set, the ignore finding is applied to all files. |
| purls | | string array | The list of PURLs to ignore packages. If `purls` is not set, the ignore finding is applied to all packages. This field is currently available only for vulnerabilities. |
| expired_at | | date (`yyyy-mm-dd`) | The expiration date of the ignore finding. If `expired_at` is not set, the ignore finding is always valid. |
| statement | | string | The reason for ignoring the finding. (This field is not used for filtering.) |
Expand Down Expand Up @@ -494,4 +494,4 @@ Please refer to the [VEX documentation](../supply-chain/vex.md) for the details.
[^1]: license name is used as id for `.trivyignore.yaml` files.
[^2]: This doesn't work for package licenses. The `path` field can only be used for license files (licenses obtained using the [--license-full flag](../scanner/license.md#full-scanning)).
[^2]: This doesn't work for os package licenses (e.g. apk, dpkg, rpm).
1 change: 1 addition & 0 deletions pkg/scanner/local/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ func (s Scanner) scanLicenses(target types.ScanTarget, options types.ScanOptions
Category: category,
PkgName: lib.Name,
Name: license,
FilePath: lib.FilePath,
Confidence: 1.0,
})
}
Expand Down

0 comments on commit 88a6154

Please sign in to comment.