Skip to content

🐛 fix: improve error messages for branch-protection and pip-install checks#5043

Open
alliasgher wants to merge 1 commit into
ossf:mainfrom
alliasgher:improve-error-messages
Open

🐛 fix: improve error messages for branch-protection and pip-install checks#5043
alliasgher wants to merge 1 commit into
ossf:mainfrom
alliasgher:improve-error-messages

Conversation

@alliasgher
Copy link
Copy Markdown
Contributor

Fixes #2946
Fixes #2444

Branch-protection token error (#2946)

  • isPermissionsError now compares case-insensitively, so resource not accessible by integration (any capitalisation from the GitHub API) is always detected instead of falling through to the generic githubv4.Query: ... message.
  • Rewrote classicBranchErrMsg to explain the cause (GITHUB_TOKEN lacks administration: read) and the fix (use a fine-grained PAT) with a direct link.

pip install hash message (#2444)

  • generateTextUnpinned now emits a specialised message for DependencyUseTypePipCommand that tells users to add --require-hashes or use a hashed requirements file, with a link to pip's secure-installs guide — instead of the generic pipCommand not pinned by hash.

Branch-protection (ossf#2946):
- Make isPermissionsError case-insensitive so that 'resource not
  accessible by integration' (any capitalisation) is consistently
  detected, preventing the generic githubv4.Query error from leaking
  through when GITHUB_TOKEN lacks admin read on branch protection.
- Reword classicBranchErrMsg to make the cause (GITHUB_TOKEN
  permission) and the fix (fine-grained PAT with 'administration: read')
  immediately clear to the user.

pip-install (ossf#2444):
- Add a specific message for DependencyUseTypePipCommand in
  generateTextUnpinned that tells users to add --require-hashes or
  use a hashed requirements file, with a link to pip's secure-installs
  guide.

Signed-off-by: alliasgher <[email protected]>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 2, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 69.83%. Comparing base (353ed60) to head (7cbce95).
⚠️ Report is 359 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5043      +/-   ##
==========================================
+ Coverage   66.80%   69.83%   +3.03%     
==========================================
  Files         230      252      +22     
  Lines       16602    15791     -811     
==========================================
- Hits        11091    11028      -63     
+ Misses       4808     3878     -930     
- Partials      703      885     +182     
🚀 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.

@alliasgher alliasgher changed the title fix: improve error messages for branch-protection and pip-install checks 🐛 fix: improve error messages for branch-protection and pip-install checks May 2, 2026
@github-actions
Copy link
Copy Markdown

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

@github-actions github-actions Bot added Stale and removed Stale labels May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Status: No status

1 participant