Skip to content

🐛 avoid processing nonexistent codeowner files #4705

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

spencerschrock
Copy link
Member

What kind of change does this PR introduce?

bug fix

What is the current behavior?

In archive file mode, the code returned a (*os.File)(nil), which could handle the call to Close() on a nil receiver. However due to how the githubrepo client handled reading files in git mode, nonexistent files returned a truly nil value, with both the type and value unset. https://go.dev/doc/faq#nil_error This led to a nil pointer dereference.

What is the new behavior (if this is a feature change)?**

We check for two types of nil codeowner files, a nil interface and a nil os.File

  • [] Tests for the changes have been added (for bug fixes/features)

Which issue(s) this PR fixes

Fixes #4704

Special notes for your reviewer

Does this PR introduce a user-facing change?

For user-facing changes, please add a concise, human-readable release note to
the release-note

(In particular, describe what changes users might need to make in their
application as a result of this pull request.)

Fixed a nil pointer dereference in the Contributors check for GitHub repos analyzed with `--file-mode=git`

This worked with the `archive` file mode, because the code returned a
(*os.File)(nil), which could handle the call to Close() on a nil
receiver. However due to how the githubrepo client handled reading files
in `git` mode, nonexistent files returned a truly nil value, with both
the type and value unset. https://go.dev/doc/faq#nil_error

Signed-off-by: Spencer Schrock <[email protected]>
@spencerschrock spencerschrock requested a review from a team as a code owner July 17, 2025 15:40
@spencerschrock spencerschrock requested review from justaugustus and raghavkaul and removed request for a team July 17, 2025 15:40
Copy link

codecov bot commented Jul 17, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.29%. Comparing base (353ed60) to head (a12f51a).
⚠️ Report is 201 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4705      +/-   ##
==========================================
+ Coverage   66.80%   68.29%   +1.48%     
==========================================
  Files         230      249      +19     
  Lines       16602    18903    +2301     
==========================================
+ Hits        11091    12909    +1818     
- Misses       4808     5133     +325     
- Partials      703      861     +158     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

This pull request has been marked stale because it has been open for 10 days with no activity

@github-actions github-actions bot added the Stale label Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

BUG nil pointer dereference in Contributors check
2 participants