Skip to content

Commit 9256804

Browse files
authored
fix(redhat): save contentSets for OS packages in fs/vm modes (#8820)
1 parent 6ebde88 commit 9256804

File tree

6 files changed

+22
-1
lines changed

6 files changed

+22
-1
lines changed

docs/docs/advanced/container/unpacked-filesystem.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,4 @@ Total: 20 (UNKNOWN: 0, LOW: 2, MEDIUM: 10, HIGH: 8, CRITICAL: 0)
113113
+--------------+------------------+----------+-------------------+---------------+---------------------------------------+
114114
```
115115

116-
</details>
116+
</details>

docs/docs/coverage/os/rhel.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ Trivy detects packages that have been installed through package managers such as
2222
## Vulnerability
2323
Red Hat offers its own security advisories, and these are utilized when scanning Red Hat Enterprise Linux (RHEL) for vulnerabilities.
2424

25+
### Content manifests
26+
Red Hat’s security advisories use CPEs to identify product sets. For example, even packages installed in the same container image can have different CPEs.
27+
For this reason, Red Hat’s container images include stored content manifests, which we convert to CPEs, and perform vulnerability scanning.
28+
29+
Since this system ties each content manifest to its packages on a per-layer basis,
30+
if layers get merged (for instance, by using `docker run` or `docker export`) we can no longer determine the correct CPE, which may lead to false detection.
31+
2532
### Data Source
2633
See [here](../../scanner/vulnerability.md#data-sources).
2734

@@ -82,3 +89,5 @@ Trivy identifies licenses by examining the metadata of RPM packages.
8289
[NVD]: https://nvd.nist.gov/vuln/detail/CVE-2023-0464
8390

8491
[vulnerability statuses]: ../../configuration/filtering.md#by-status
92+
93+
[content-set-default]: https://github.com/aquasecurity/trivy/blob/c80310d7690d8aeb7d3d77416c18c0c8b9aebe17/pkg/detector/ospkg/redhat/redhat.go#L25-L42

docs/docs/target/rootfs.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ $ trivy rootfs /path/to/rootfs
1414
You should use `trivy fs` to scan your local projects in CI/CD.
1515
See [here](../scanner/vulnerability.md) for the differences.
1616

17+
!!! note
18+
Scanning vulnerabilities for `Red Hat` has a limitation, see the [Red Hat](../coverage/os/rhel.md#content-manifests) page for details.
19+
1720
## Performance Optimization
1821

1922
By default, Trivy traverses all files from the specified root directory to find target files for scanning.

docs/docs/target/vm.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ See [here](../scanner/vulnerability.md) for the detail.
150150
$ trivy vm [YOUR_VM_IMAGE]
151151
```
152152

153+
!!! note
154+
Scanning `Red Hat` has a limitation, see the [Red Hat](../coverage/os/rhel.md#content-manifests) page for details.
155+
153156
### Misconfigurations
154157
It is supported, but it is not useful in most cases.
155158
As mentioned [here](../scanner/misconfiguration/index.md), Trivy mainly supports Infrastructure as Code (IaC) files for misconfigurations.

pkg/fanal/artifact/local/fs.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,9 @@ func (a Artifact) Inspect(ctx context.Context) (artifact.Reference, error) {
207207
Secrets: result.Secrets,
208208
Licenses: result.Licenses,
209209
CustomResources: result.CustomResources,
210+
211+
// For Red Hat
212+
BuildInfo: result.BuildInfo,
210213
}
211214

212215
if err = a.handlerManager.PostHandle(ctx, result, &blobInfo); err != nil {

pkg/fanal/artifact/vm/vm.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ func (a *Storage) Analyze(ctx context.Context, r *io.SectionReader) (types.BlobI
157157
Secrets: result.Secrets,
158158
Licenses: result.Licenses,
159159
CustomResources: result.CustomResources,
160+
161+
// For Red Hat
162+
BuildInfo: result.BuildInfo,
160163
}
161164

162165
if err = a.handlerManager.PostHandle(ctx, result, &blobInfo); err != nil {

0 commit comments

Comments
 (0)