Skip to content

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

Open
rickgcv wants to merge 1 commit into
ossf:mainfrom
rickgcv:fix/improve-error-messages-branch-protection-pip
Open

fix: improve error messages for branch-protection and pip-install checks#5174
rickgcv wants to merge 1 commit into
ossf:mainfrom
rickgcv:fix/improve-error-messages-branch-protection-pip

Conversation

@rickgcv

@rickgcv rickgcv commented Aug 11, 2026

Copy link
Copy Markdown

Summary

  • Makes isPermissionsError case-insensitive so the helpful error message is always shown when GITHUB_TOKEN lacks branch protection read permission, regardless of API capitalisation
  • Rewrites classicBranchErrMsg to name the missing permission (administration:read) and link directly to the fix
  • Adds a pip-specific message in generateTextUnpinned explaining how to pin pip dependencies with --require-hashes or a requirements file

Fixes #2946
Fixes #2444

Notes

The previous PR #5043 addressed these same issues but went stale and was closed without merging. This picks up that work.

Test plan

  • make unit-test passes with no failures
  • go test ./clients/githubrepo/... ./probes/pinsDependencies/... passes

- Make isPermissionsError case-insensitive to handle API capitalisation
  differences when GITHUB_TOKEN lacks admin permission on branch protection
- Rewrite classicBranchErrMsg to name the missing permission and link to fix
- Add pip-specific message in generateTextUnpinned pointing to --require-hashes

Fixes ossf#2946
Fixes ossf#2444

Signed-off-by: Ricardo Garcia Cavero <57412427+rickgcv@users.noreply.github.com>
@rickgcv
rickgcv requested a review from a team as a code owner August 11, 2026 09:43
@rickgcv
rickgcv requested review from jeffmendoza and spencerschrock and removed request for a team August 11, 2026 09:43
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Aug 11, 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