Skip to content

fix(pkg/validation/internal): check nil pointers before dereference#493

Open
alrs wants to merge 1 commit into
operator-framework:masterfrom
alrs:internal-nil
Open

fix(pkg/validation/internal): check nil pointers before dereference#493
alrs wants to merge 1 commit into
operator-framework:masterfrom
alrs:internal-nil

Conversation

@alrs
Copy link
Copy Markdown

@alrs alrs commented May 26, 2026

Several of the functions in pkg/validation/internal properly 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.

Copilot AI review requested due to automatic review settings May 26, 2026 04:39
@openshift-ci openshift-ci Bot requested review from kevinrizza and tmshort May 26, 2026 04:39
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.ManifestResult without using bundle.Name upfront in multiple validators
  • Assign result.Name only after the bundle == nil guard

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.

@perdasilva
Copy link
Copy Markdown
Contributor

/ok-to-test

@openshift-ci openshift-ci Bot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label May 26, 2026
@perdasilva
Copy link
Copy Markdown
Contributor

@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
Copy link
Copy Markdown

codecov Bot commented May 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 22.16%. Comparing base (3acdcf5) to head (4b5f809).
⚠️ Report is 1 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tmshort
Copy link
Copy Markdown
Contributor

tmshort commented May 26, 2026

/approve

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 26, 2026

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants