Skip to content

ROX-29284: set last affected as empty fixed by version#15457

Merged
daynewlee merged 2 commits intomasterfrom
yli3/nofixedBy
May 28, 2025
Merged

ROX-29284: set last affected as empty fixed by version#15457
daynewlee merged 2 commits intomasterfrom
yli3/nofixedBy

Conversation

@daynewlee
Copy link
Contributor

@daynewlee daynewlee commented May 28, 2025

Description

fixed in version in format of introduced=9.0.13&lastAffected=9.0.62 doesn't provide anything useful, so set it as empty

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

Unit tests added, let me know if manual tests are needed although I think unit tests are good enough.

@openshift-ci
Copy link

openshift-ci bot commented May 28, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@rhacs-bot
Copy link
Contributor

rhacs-bot commented May 28, 2025

Images are ready for the commit at 080ba01.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.8.x-825-g080ba01746.

@codecov
Copy link

codecov bot commented May 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 49.25%. Comparing base (fdd9fd3) to head (080ba01).
Report is 16 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #15457      +/-   ##
==========================================
+ Coverage   49.23%   49.25%   +0.01%     
==========================================
  Files        2578     2581       +3     
  Lines      189205   189330     +125     
==========================================
+ Hits        93157    93251      +94     
- Misses      88711    88739      +28     
- Partials     7337     7340       +3     
Flag Coverage Δ
go-unit-tests 49.25% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@daynewlee daynewlee marked this pull request as ready for review May 28, 2025 15:21
@daynewlee daynewlee requested a review from a team as a code owner May 28, 2025 15:21
@daynewlee daynewlee requested review from BradLugo, RTann, dcaravel and jvdm May 28, 2025 15:21
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @daynewlee - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@BradLugo
Copy link
Contributor

Could there be a case where a vulnerability is fixable, but claircore's FixedInVersion URL contains lastAffected? If so, is showing the user an empty string or the full claircore FixedInVersion URL better?

@daynewlee
Copy link
Contributor Author

Could there be a case where a vulnerability is fixable, but claircore's FixedInVersion URL contains lastAffected? If so, is showing the user an empty string or the full claircore FixedInVersion URL better?

The interesting thing is that we decide if a vuln is fixable based on if there's a fixedIn version:

IsFixable: from.GetFixedBy() != "",

(Let me know if you see other logics making this judgement differently. )
So what we do is: sees lastAffected => find nothing useful => telling the user not fixable. Since we can't assume a fixed in version from "last Affected" so we decide it's not fixable
cc: @BradLugo

@BradLugo
Copy link
Contributor

Ah, so this PR makes what we display consistent with the logic that determines if the vulnerability is fixable? That makes sense.

Copy link
Contributor

@BradLugo BradLugo left a comment

Choose a reason for hiding this comment

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

LGTM!

@openshift-ci
Copy link

openshift-ci bot commented May 28, 2025

@daynewlee: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/gke-qa-e2e-tests 080ba01 link false /test gke-qa-e2e-tests

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@daynewlee daynewlee merged commit 5765d3c into master May 28, 2025
95 of 96 checks passed
@daynewlee daynewlee deleted the yli3/nofixedBy branch May 28, 2025 21:49
Comment on lines +823 to +825
} else if err == nil && q.Has("lastAffected") {
// lastAffected doesn't give us anything informative so return empty string
return ""
Copy link
Contributor

Choose a reason for hiding this comment

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

probably unlikely to happen, but I wonder if we'd ever see introduced, only. In that case, then we will still be showing introduced=<whatever>. @daynewlee can we consider a followup to maybe also consider looking for introduced?

another consideration:

q, err := url.ParseQuery(fixedIn)
if err != nil {
	// v.FixedInVersion is not url encoded, so just return it as-is.
	return fixedIn
}
if q.Has("fixed") {
	return q.Get("fixed")
}
return ""

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.

4 participants