-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(redhat): migrate OVALv2 from CSAF VEX #483
Draft
knqyf263
wants to merge
19
commits into
aquasecurity:main
Choose a base branch
from
knqyf263:redhat_csaf_vex
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
This reverts commit 1e06669bf5328f61da2eeceb4a8fa4a60b3ee382.
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
This reverts commit e67d63222704db77ddfb200fe65fad8e740d3702.
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
Signed-off-by: knqyf263 <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR migrates the Red Hat vulnerability data source from OVALv2 to CSAF VEX format as requested by Red Hat.
Reference: https://www.redhat.com/en/blog/red-hat-vex-files-cves-are-now-generally-available
Implementation Flow
As described in aquasecurity/trivy#7452, modified the implementation to not process "product_status" since the status information (e.g., "fixed", "affected") can be obtained from "remediations" which contains product_id.
Implementation Details
While CSAF VEX stores advisories per CVE-ID, Trivy DB (following OVALv2's approach) stores patched vulnerabilities per RHSA-ID. For example:
This means we cannot process files individually and need to parse all files first, then rebuild them per RHSA-ID so that the new database will not break old clients.
The implementation consists of three main components:
<package>-<vulnerability-id>
pairsImplementation Notes
The parsed data is currently stored in memory. Initially, I created a temporary BoltDB for storage due to concerns about data size, but this significantly slowed down processing. After measuring the actual data size (560MB as of January 16, 2024), I determined that in-memory storage was feasible. If the data size grows substantially in the future, we may need to revise this implementation.
Blockers
As of January 16, 2025, there are significant differences in package name handling:
Trivy currently compares binary package names, which works with OVALv2. However, with CSAF VEX, unpatched vulnerabilities need to be compared using source package names, which means older Trivy versions won't be able to detect unpatched vulnerabilities correctly. It would be a breaking change.
This issue has been raised with Red Hat and is being tracked at: https://issues.redhat.com/browse/SECDATA-856
Important Notes
The following issues were discovered during data analysis:
Unclear PURL Namespaces
While PURLs typically use the
redhat
namespace, some use different namespaces.Example:
pkg:rpm/redhat/satellite_client_6/foreman_ygg_worker?arch=src
This isn't related to module streams, and its purpose is unclear. Currently treating
satellite_client_6/foreman_ygg_worker
as part of the package name, though this data is effectively unused as Trivy doesn't construct such package names.Issue tracked at: https://issues.redhat.com/browse/SECDATA-854
Missing PURLs
Despite documentation stating that
product_version
objects always include PURLs (https://redhatproductsecurity.github.io/security-data-guidelines/csaf-vex/), some cases lack PURLs.Documentation states:
Example of missing PURL:
https://github.com/aquasecurity/vuln-list-redhat/blob/925beb2b9a400640a45f8ea6fc7ea57ab4ae63ff/csaf-vex/2001/cve-2001-0131.json#L216-L223
Duplicate product_versions
Some files contain identical
product_version
s multiple times.Examples:
https://github.com/aquasecurity/vuln-list-redhat/blob/42df5998a5f20d1a1cb67978486fffd82e61c34e/csaf-vex/2004/cve-2004-0885.json#L272-L282
https://github.com/aquasecurity/vuln-list-redhat/blob/42df5998a5f20d1a1cb67978486fffd82e61c34e/csaf-vex/2004/cve-2004-0885.json#L470-L480
Identical CPEs
Different
product_id
s may share the same CPE. Implementation must account for this to avoid duplicates.Example:
https://github.com/aquasecurity/vuln-list-redhat/blob/ce0ad982c845fc24cabcf5678c3063b3b54dc500/csaf-vex/2015/cve-2015-4866.json#L206-L249
Source to Binary Package Mapping
While RHSAs include both source and binary packages for patched vulnerabilities, there's currently no way to map between them in CSAF VEX.
Example: Unable to determine which binary packages correspond to
BaseOS-8.7.0.Z.MAIN:python-setuptools-0:39.2.0-6.el8_7.1.src
from:Advisory Discrepancies
CSAF VEX-only advisories
Some advisories exist only in CSAF VEX, not in OVALv2.
Example: https://access.redhat.com/errata/RHSA-2023:4655
OVALv2-only advisories
Some advisories exist only in OVALv2, not in CSAF VEX.
Example: https://github.com/aquasecurity/vuln-list-redhat/blob/ac1041557cea771cc6ca106453202cbc4de7a139/oval/9/rhel-9-including-unpatched/definitions/2020/CVE-2020-26146.json
While this specific CVE issue was resolved after the Vuls maintainer contacted Red Hat, similar issues likely exist.