fix(pkg/validation/internal): check nil pointers before dereference#493
fix(pkg/validation/internal): check nil pointers before dereference#493alrs wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR prevents potential panics when validating bundles by avoiding dereferencing bundle.Name before confirming bundle is non-nil.
Changes:
- Initialize
errors.ManifestResultwithout usingbundle.Nameupfront in multiple validators - Assign
result.Nameonly after thebundle == nilguard
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/validation/internal/operatorhubv2.go | Avoids nil deref by setting result.Name after the nil check |
| pkg/validation/internal/operatorhub.go | Avoids nil deref by setting result.Name after the nil check |
| pkg/validation/internal/community.go | Avoids nil deref by setting result.Name after the nil check |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/ok-to-test |
|
@grokspawn it would be good if you could 👀 this. I don't know if there was a reason to set the name in the result. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #493 +/- ##
==========================================
+ Coverage 22.13% 22.16% +0.02%
==========================================
Files 60 60
Lines 7869 7872 +3
==========================================
+ Hits 1742 1745 +3
Misses 5969 5969
Partials 158 158 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: tmshort The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Several of the functions in
pkg/validation/internalproperly check to make sure that they haven't received a nil pointer, but they imporperly do it only after first attempting to dereference the pointer.