Conversation
A perhaps extreme edge case existed where the singleton would return a non-nil client at the scan entrypoint point and then return a nil client later on - causing a nil pointer exception and crash Sensor.
|
Skipping CI for Draft Pull Request. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThe change removes Scanner V2 support, restricts singleton creation to Scanner V4, and passes one captured scanner client through image analysis. ChangesScanner client flow
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The captured-client regression test covers the intended nil-client edge case. No merge-blocking issue is identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #22836 +/- ##
==========================================
- Coverage 51.83% 51.80% -0.03%
==========================================
Files 2901 2901
Lines 182807 182763 -44
==========================================
- Hits 94749 94681 -68
- Misses 79770 79773 +3
- Partials 8288 8309 +21
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
/konflux-retest checks |
2 similar comments
|
/konflux-retest checks |
|
/konflux-retest checks |
🚀 Build Images ReadyImages are ready for commit d46f942. To use with deploy scripts: export MAIN_IMAGE_TAG=5.0.x-298-gd46f9423ad |
| // Check if there is a local Scanner. | ||
| // No need to continue if there is no local Scanner. | ||
| if s.scannerClientSingleton() == nil { | ||
| scannerClient := s.scannerClientSingleton() |
There was a problem hiding this comment.
Looking at all of these changes in this file - is there actually any change happening here? If I'm reading this all correctly aren't both implementations doing the exact same thing.
I'll admit the new way feels cleaner and more readable (and doesn't rely on implicit global state) but I just want to make sure I'm not missing something :)
There was a problem hiding this comment.
Oh, nvm - I see that this is the fix for the TOCTOU mentioned.
There was a problem hiding this comment.
s.scannerClientSingleton() could return non-nil on the first invocation and nil on the second invocation in scanImage which would cause a panic. This PR re-uses the returned object to avoid that.
Description
Delegated scan requests will hang for the full timeout (10 mins) when a Secured Cluster only has Scanner V4 installed and Central does not have Scanner V4 installed.
There is historically no Scanner V2 specific capability/message exchanged between Central/Sensor to indicate Scanner V2 is installed.
Now that Scanner V2 is removed, there is no need for Sensor to try to connect to it. This PR removes that path.
Additionally fixes a potential TOCTOU nil pointer panic in Sensor delegated scanning flow that could occur in an (assumingly) extreme edge case (Central's advertised scanner state changes after a delegated scan starts but before the scan request is sent to scanner)
User-facing documentation
Testing and quality
Automated testing
How I validated my change
CI and manual testing