-
Notifications
You must be signed in to change notification settings - Fork 152
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: handling of same fix version with different elsa ids and include elsa ids for aqua storage,remove them before saving into oss db #484
base: main
Are you sure you want to change the base?
Conversation
santhosh1729
commented
Jan 19, 2025
- Modify Oracle tracker to include logic for saving advisory IDs (ELSA IDs) in the database.
- Modify Oracle tracker to include logic for saving advisory IDs (ELSA IDs) in the database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @santhosh1729
Thanks for your work!
We are worried about size of trivy-db.
Can you check and write actual and new sizes for DBs?
Also i left 1 comment, take a look, please.
for k, v := range latestVersions { | ||
versionToArches[v] = append(versionToArches[v], k.Arch) | ||
adv := versionToArches[v.FixedVersion] | ||
adv.VendorIDs = v.VendorIDs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be wrong for case when 2 advisories with same fixedVersion got from 2 different ELSA-IDs
e.g.
- ELSA-xxxx-0001 - fixedVersion == 0.0.1, arch == amd64
- ELSA-xxxx-0002 - fixedVersion == 0.0.1, arch == aarch64
for this case entry will include only one ELSA-xxxx-0002 (or 0001)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps we need to create 2 different entries for this case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DmitriyLewen Thanks for the review.
As trivy doesn't need this vendor ids data in db, removed them before storing in db so there is no impact on db size.
Addressed same fix version with different elsa-ids and architectures case.
Can you please review this? Thank you!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @santhosh1729
I'm busy with Trivy release right now.
I'll check your PR after release.
…e elsa ids for aqua storage,remove them before saving into oss db
I see a little differently how we can work with vendorIDs. |
|
Hi @santhosh1729 |
yes, I reopened it. Your changes work for the Aqua use case, but there is a chance the wrong fix version when a CVE is addressed in multiple advisories. For example, CVE-2024-25742 affecting kernel-tools has different fix versions for advisories: 0:5.14.0-427.16.1.el9_4 – ELSA-2024-2758 https://github.com/aquasecurity/vuln-list/blob/main/oval/oracle/2024/ELSA-2024-2758.json |
But these advisories are for different versions of Oracle Linux. So these advisories will be saved in different containers. Or am I missing something? |
Sorry, I overlooked the os version. |
No problem. Can you update your PR based on these changes? |
Sure, I will take care of that The latest Trivy-DB includes log changes, and Aqua consumes these changes. we encounter an issue because the logger is a private variable. Can I update the logger to be public everywhere? 388c617#diff-4e5beea79657fce401854eb1e0e4558528a32279f61876579816724a01b38d2cR51 |
hm... type WrappedVulnSrc struct {
newField string
oracleoval.VulnSrc
}
func (w WrappedVulnSrc) testFunc() {
// you need to get logger here
} Or do you have another case? Anyway i think it is better to create another PR for these changes (we can review new PR the first) |
We use OSS tracker by creating the object for struct
|
Got it! |
I'm on vacation now. I'll take a look tomorrow. |
7878911
to
4c8abbe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@santhosh1729 thanks for your work!
LGTM
@knqyf263 tell me if you will watch this PR. If not - I will merge it.
I'm reviewing this PR now. |
@santhosh1729 Doesn't this work?
|
The logger needs to be initialized; otherwise, an error will occur at |
It's initialized here through NewVulnSrc. trivy-db/pkg/vulnsrc/alma/alma.go Line 62 in 518f562
|
Aqua uses this way by overriding the Put function on Aqua's end
|
Hmm. Why doesn't #484 (comment) work? The logger is initialized and you can override |