Skip to content
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(alpine): support unfixed vulnerabilities #1235

Merged
merged 3 commits into from
Sep 16, 2021
Merged

feat(alpine): support unfixed vulnerabilities #1235

merged 3 commits into from
Sep 16, 2021

Conversation

knqyf263
Copy link
Collaborator

Overview

Trivy DB doesn't insert security advisories for unfixed vulnerabilities, so Trivy cannot detect unfixed vulnerabilities at the moment. This PR is for the future.

Related PRs

@knqyf263 knqyf263 self-assigned this Sep 15, 2021

// This logic is for unfixed vulnerabilities, but Trivy DB doesn't have advisories for unfixed vulnerabilities
// because Alpine just provides potentially vulnerable packages. It will cause a lot of false positives.
if adv.FixedVersion == "" {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current logic in Cybercenter is, we look for range.
If installedVersion >AffectedFrom && installedVersion <= AffectedTo{
vulns = append(vulns, vuln)
}
We need to add affectedFrom and affectedTo in trivy-db types.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we take the information from NVD, it is true. But we take it from Alpine Security Tracker which provides potentially vulnerable packages. We don't need to care about affectedFrom and affectedTo because secfixes tracker already compares versions with minimum and maximum versions.
https://gitlab.alpinelinux.org/kaniini/secfixes-tracker/-/blob/master/secfixes_tracker/models.py#L266-301

If we compare it again, it doesn't make sense. We just do the same thing twice.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. I get it. Please consider below scenario

  1. I have curl v1.5 package
  2. sec fix tracker says that 2.0 (current/latest version) is vulnerable
  3. Now, with this logic we will show v1.5 also as vulnerable.

there can be a chance that the installed version is not vulnerable. latest version of the package is only vulnerable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, but it is the same as fixed vulnerabilities, right? Alpine doesn't provide introduced versions, but fixed versions only. What do you think about it? Do we support the introduced versions only for unpatched vulnerabilities?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, so all version below this version are vulnerable. Okay this is good

Copy link
Collaborator Author

@knqyf263 knqyf263 Sep 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is enough to support minimum versions. I've fixed that. While building DB, you need to insert minimum versions into the AffectedVersion field.
03eece3

@knqyf263 knqyf263 merged commit 8cd7de2 into main Sep 16, 2021
@knqyf263 knqyf263 deleted the alpine_unfixed branch September 16, 2021 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants